diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-04 17:07:15 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-04 17:07:15 +0000 |
commit | ca8fac11debc908d4fd8c57aecd8186d2245562c (patch) | |
tree | 4b2938e2cbf6005d3f86b6b8fac529b307c3a851 /ui/views | |
parent | 3fa4b2090c00cb0eb501c4ee579e759a5dd2e00b (diff) | |
download | chromium_src-ca8fac11debc908d4fd8c57aecd8186d2245562c.zip chromium_src-ca8fac11debc908d4fd8c57aecd8186d2245562c.tar.gz chromium_src-ca8fac11debc908d4fd8c57aecd8186d2245562c.tar.bz2 |
views: Get rid of WidgetDelegate::ShouldShowClientEdge().
This always returns true and nobody is overriding it. So this patch removes it altogether.
R=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9965090
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130651 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/widget/widget_delegate.cc | 4 | ||||
-rw-r--r-- | ui/views/widget/widget_delegate.h | 3 | ||||
-rw-r--r-- | ui/views/window/custom_frame_view.cc | 28 | ||||
-rw-r--r-- | ui/views/window/custom_frame_view.h | 3 |
4 files changed, 13 insertions, 25 deletions
diff --git a/ui/views/widget/widget_delegate.cc b/ui/views/widget/widget_delegate.cc index 1865d22..baaf65b 100644 --- a/ui/views/widget/widget_delegate.cc +++ b/ui/views/widget/widget_delegate.cc @@ -77,10 +77,6 @@ bool WidgetDelegate::ShouldShowWindowTitle() const { return true; } -bool WidgetDelegate::ShouldShowClientEdge() const { - return true; -} - SkBitmap WidgetDelegate::GetWindowAppIcon() { // Use the window icon as app icon by default. return GetWindowIcon(); diff --git a/ui/views/widget/widget_delegate.h b/ui/views/widget/widget_delegate.h index 0cdc9e9..4d516d8 100644 --- a/ui/views/widget/widget_delegate.h +++ b/ui/views/widget/widget_delegate.h @@ -79,9 +79,6 @@ class VIEWS_EXPORT WidgetDelegate { // Returns true if the window should show a title in the title bar. virtual bool ShouldShowWindowTitle() const; - // Returns true if the window's client view wants a client edge. - virtual bool ShouldShowClientEdge() const; - // Returns the app icon for the window. On Windows, this is the ICON_BIG used // in Alt-Tab list and Win7's taskbar. virtual SkBitmap GetWindowAppIcon(); diff --git a/ui/views/window/custom_frame_view.cc b/ui/views/window/custom_frame_view.cc index b42fa05..b692fb0 100644 --- a/ui/views/window/custom_frame_view.cc +++ b/ui/views/window/custom_frame_view.cc @@ -100,7 +100,6 @@ CustomFrameView::CustomFrameView() close_button_(NULL), window_icon_(NULL), should_show_minmax_buttons_(false), - should_show_client_edge_(false), frame_background_(new FrameBackground()) { } @@ -127,7 +126,6 @@ void CustomFrameView::Init(Widget* frame) { IDR_RESTORE, IDR_RESTORE_H, IDR_RESTORE_P); should_show_minmax_buttons_ = frame_->widget_delegate()->CanMaximize(); - should_show_client_edge_ = frame_->widget_delegate()->ShouldShowClientEdge(); if (frame_->widget_delegate()->ShouldShowWindowIcon()) { window_icon_ = new ImageButton(this); @@ -291,10 +289,6 @@ int CustomFrameView::IconSize() const { #endif } -bool CustomFrameView::ShouldShowClientEdge() const { - return should_show_client_edge_ && !frame_->IsMaximized(); -} - gfx::Rect CustomFrameView::IconBounds() const { int size = IconSize(); int frame_thickness = FrameBorderThickness(); @@ -318,15 +312,18 @@ gfx::Rect CustomFrameView::IconBounds() const { return gfx::Rect(frame_thickness + kIconLeftSpacing, y, size, size); } -void CustomFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { - // Window frame mode. - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); +bool CustomFrameView::ShouldShowClientEdge() const { + return !frame_->IsMaximized(); +} +void CustomFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { frame_background_->set_frame_color(GetFrameColor()); const SkBitmap* frame_image = GetFrameBitmap(); frame_background_->set_theme_bitmap(frame_image); frame_background_->set_top_area_height(frame_image->height()); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + frame_background_->SetCornerImages( rb.GetImageNamed(IDR_WINDOW_TOP_LEFT_CORNER).ToSkBitmap(), rb.GetImageNamed(IDR_WINDOW_TOP_RIGHT_CORNER).ToSkBitmap(), @@ -342,35 +339,34 @@ void CustomFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { } void CustomFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - const SkBitmap* frame_image = GetFrameBitmap(); frame_background_->set_theme_bitmap(frame_image); frame_background_->set_top_area_height(frame_image->height()); - frame_background_->PaintMaximized(canvas, this); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + // TODO(jamescook): Migrate this into FrameBackground. // The bottom of the titlebar actually comes from the top of the Client Edge // graphic, with the actual client edge clipped off the bottom. const SkBitmap* titlebar_bottom = rb.GetImageNamed( IDR_APP_TOP_CENTER).ToSkBitmap(); int edge_height = titlebar_bottom->height() - - (ShouldShowClientEdge() ? kClientEdgeThickness : 0); + (ShouldShowClientEdge() ? kClientEdgeThickness : 0); canvas->TileImageInt(*titlebar_bottom, 0, frame_->client_view()->y() - edge_height, width(), edge_height); } void CustomFrameView::PaintTitleBar(gfx::Canvas* canvas) { - WidgetDelegate* d = frame_->widget_delegate(); + WidgetDelegate* delegate = frame_->widget_delegate(); // It seems like in some conditions we can be asked to paint after the window // that contains us is WM_DESTROYed. At this point, our delegate is NULL. The // correct long term fix may be to shut down the RootView in WM_DESTROY. - if (!d) + if (!delegate) return; - canvas->DrawStringInt(d->GetWindowTitle(), GetTitleFont(), + canvas->DrawStringInt(delegate->GetWindowTitle(), GetTitleFont(), SK_ColorWHITE, GetMirroredXForRect(title_bounds_), title_bounds_.y(), title_bounds_.width(), title_bounds_.height()); diff --git a/ui/views/window/custom_frame_view.h b/ui/views/window/custom_frame_view.h index 8ddc6ea..aced021 100644 --- a/ui/views/window/custom_frame_view.h +++ b/ui/views/window/custom_frame_view.h @@ -83,7 +83,7 @@ class CustomFrameView : public NonClientFrameView, gfx::Rect IconBounds() const; // Returns true if the client edge should be drawn. This is true if - // the window delegate wants a client edge and we are not maxmized. + // the window is not maximized. bool ShouldShowClientEdge() const; // Paint various sub-components of this view. @@ -124,7 +124,6 @@ class CustomFrameView : public NonClientFrameView, ImageButton* close_button_; ImageButton* window_icon_; bool should_show_minmax_buttons_; - bool should_show_client_edge_; // Background painter for the window frame. scoped_ptr<FrameBackground> frame_background_; |