Commit 82a948f9 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

exo: migrate some WidgetDelegate overrides to setters

Instead of overriding GetWindow{Title,Icon}, use the explicit
setters for these values, and don't store the title/icon locally.

Bug: 1075649
Change-Id: Ic69156fa8c5265bb2b421e9a56470ad5812c84be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2412987Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807613}
parent 390ed8eb
......@@ -140,7 +140,7 @@ void ShellSurface::AcknowledgeConfigure(uint32_t serial) {
void ShellSurface::SetParent(ShellSurface* parent) {
TRACE_EVENT1("exo", "ShellSurface::SetParent", "parent",
parent ? base::UTF16ToASCII(parent->title_) : "null");
parent ? base::UTF16ToASCII(parent->GetWindowTitle()) : "null");
SetParentWindow(parent ? parent->GetWidget()->GetNativeWindow() : nullptr);
}
......
......@@ -316,6 +316,8 @@ ShellSurfaceBase::ShellSurfaceBase(Surface* surface,
SetRootSurface(surface);
host_window()->Show();
set_owned_by_client();
SetShowTitle(false);
}
ShellSurfaceBase::~ShellSurfaceBase() {
......@@ -352,18 +354,12 @@ void ShellSurfaceBase::Activate() {
void ShellSurfaceBase::SetTitle(const base::string16& title) {
TRACE_EVENT1("exo", "ShellSurfaceBase::SetTitle", "title",
base::UTF16ToUTF8(title));
title_ = title;
if (widget_)
widget_->UpdateWindowTitle();
WidgetDelegate::SetTitle(title);
}
void ShellSurfaceBase::SetIcon(const gfx::ImageSkia& icon) {
TRACE_EVENT0("exo", "ShellSurfaceBase::SetIcon");
icon_ = icon;
if (widget_)
widget_->UpdateWindowIcon();
WidgetDelegate::SetIcon(icon);
}
void ShellSurfaceBase::SetSystemModal(bool system_modal) {
......@@ -521,7 +517,7 @@ std::unique_ptr<base::trace_event::TracedValue>
ShellSurfaceBase::AsTracedValue() const {
std::unique_ptr<base::trace_event::TracedValue> value(
new base::trace_event::TracedValue());
value->SetString("title", base::UTF16ToUTF8(title_));
value->SetString("title", base::UTF16ToUTF8(GetWindowTitle()));
if (GetWidget() && GetWidget()->GetNativeWindow()) {
const std::string* application_id =
GetShellApplicationId(GetWidget()->GetNativeWindow());
......@@ -694,18 +690,6 @@ bool ShellSurfaceBase::CanMinimize() const {
return !parent_ && can_minimize_;
}
base::string16 ShellSurfaceBase::GetWindowTitle() const {
return title_;
}
bool ShellSurfaceBase::ShouldShowWindowTitle() const {
return false;
}
gfx::ImageSkia ShellSurfaceBase::GetWindowIcon() {
return icon_;
}
bool ShellSurfaceBase::OnCloseRequested(
views::Widget::ClosedReason close_reason) {
if (!pre_close_callback_.is_null())
......
......@@ -159,9 +159,6 @@ class ShellSurfaceBase : public SurfaceTreeHost,
bool CanResize() const override;
bool CanMaximize() const override;
bool CanMinimize() const override;
base::string16 GetWindowTitle() const override;
bool ShouldShowWindowTitle() const override;
gfx::ImageSkia GetWindowIcon() override;
bool OnCloseRequested(views::Widget::ClosedReason close_reason) override;
void WindowClosing() override;
views::Widget* GetWidget() override;
......@@ -269,7 +266,6 @@ class ShellSurfaceBase : public SurfaceTreeHost,
int64_t pending_display_id_ = display::kInvalidDisplayId;
base::Optional<gfx::Rect> shadow_bounds_;
bool shadow_bounds_changed_ = false;
base::string16 title_;
SurfaceFrameType frame_type_ = SurfaceFrameType::NONE;
bool is_popup_ = false;
bool has_grab_ = false;
......@@ -309,7 +305,6 @@ class ShellSurfaceBase : public SurfaceTreeHost,
base::OnceClosure surface_destroyed_callback_;
bool system_modal_ = false;
bool non_system_modal_window_was_active_ = false;
gfx::ImageSkia icon_;
gfx::Size minimum_size_;
gfx::Size pending_minimum_size_;
gfx::Size maximum_size_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment