Chromium Code Reviews| Index: chrome/browser/ui/panels/panel_browser_frame_view.cc |
| =================================================================== |
| --- chrome/browser/ui/panels/panel_browser_frame_view.cc (revision 97031) |
| +++ chrome/browser/ui/panels/panel_browser_frame_view.cc (working copy) |
| @@ -51,6 +51,9 @@ |
| // The spacing in pixels between buttons or the button and the adjacent control. |
| const int kButtonSpacing = 6; |
| +// The panel can be minimized to 3-pixel lines. |
| +const int kMinimizedPanelHeight = 3; |
| + |
| // Colors used in painting the titlebar for drawing attention. |
| const SkColor kBackgroundColorForAttention = 0xfffa983a; |
| const SkColor kTitleTextColorForAttention = SK_ColorWHITE; |
| @@ -100,8 +103,7 @@ |
| ButtonResources close_button_resources; |
| EdgeResources frame_edges; |
| EdgeResources client_edges; |
| -gfx::Font* active_font = NULL; |
| -gfx::Font* inactive_font = NULL; |
| +gfx::Font* title_font = NULL; |
| SkBitmap* background_bitmap_for_attention = NULL; |
| void LoadImageResources() { |
| @@ -131,8 +133,7 @@ |
| resources_initialized = true; |
| ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| - active_font = new gfx::Font(rb.GetFont(ResourceBundle::BoldFont)); |
| - inactive_font = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont)); |
| + title_font = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont)); |
| // Creates a bitmap of the specified color. |
| background_bitmap_for_attention = new SkBitmap(); |
| @@ -355,15 +356,6 @@ |
| } |
| void PanelBrowserFrameView::Layout() { |
| - // If the panel height is smaller than the title-bar height, as in minimized |
| - // case, we hide all controls. |
| - bool is_control_visible = height() >= kTitlebarHeight; |
| - close_button_->SetVisible(is_control_visible); |
| - settings_button_->SetVisible( |
| - is_control_visible && is_settings_button_visible_); |
| - title_icon_->SetVisible(is_control_visible); |
| - title_label_->SetVisible(is_control_visible); |
| - |
| // Layout the close button. |
| gfx::Size close_button_size = close_button_->GetPreferredSize(); |
| close_button_->SetBounds( |
| @@ -561,6 +553,10 @@ |
| return kFrameBorderThickness + kTitlebarHeight + kClientEdgeThickness; |
| } |
| +int PanelBrowserFrameView::MinimizedPanelHeight() { |
| + return kMinimizedPanelHeight; |
| +} |
| + |
| SkColor PanelBrowserFrameView::GetTitleColor(PaintState paint_state) const { |
| switch (paint_state) { |
| case PAINT_AS_INACTIVE: |
| @@ -577,16 +573,7 @@ |
| } |
| gfx::Font* PanelBrowserFrameView::GetTitleFont(PaintState paint_state) const { |
|
jennb
2011/08/17 23:01:35
Should we change this method to not take paint_sta
|
| - switch (paint_state) { |
| - case PAINT_AS_INACTIVE: |
| - case PAINT_FOR_ATTENTION: |
| - return inactive_font; |
| - case PAINT_AS_ACTIVE: |
| - return active_font; |
| - default: |
| - NOTREACHED(); |
| - return NULL; |
| - } |
| + return title_font; |
| } |
| SkBitmap* PanelBrowserFrameView::GetFrameTheme(PaintState paint_state) const { |
| @@ -625,6 +612,10 @@ |
| // Draw the theme frame. |
| canvas->TileImageInt(*theme_frame, 0, 0, width(), height()); |
| + // No need to paint other stuffs if panel is minimized. |
|
jennb
2011/08/17 23:01:35
s/stuffs/stuff
|
| + if (height() <= kMinimizedPanelHeight) |
| + return; |
| + |
| // Draw the top border. |
| canvas->DrawBitmapInt(*(frame_edges.top_left), 0, 0); |
| canvas->TileImageInt( |
| @@ -667,6 +658,10 @@ |
| void PanelBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) { |
| int client_area_top = client_view_bounds_.y(); |
| + // No need to paint other stuffs if panel is minimized. |
|
jennb
2011/08/17 23:01:35
Ditto.
|
| + if (height() <= kMinimizedPanelHeight) |
| + return; |
| + |
| // Draw the top edge. |
| int top_edge_y = client_area_top - client_edges.top->height(); |
| canvas->DrawBitmapInt( |