| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" | 5 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| 11 #include "chrome/browser/themes/theme_service_factory.h" |
| 11 #include "chrome/browser/ui/panels/panel.h" | 12 #include "chrome/browser/ui/panels/panel.h" |
| 12 #include "chrome/browser/ui/panels/panel_browser_view.h" | 13 #include "chrome/browser/ui/panels/panel_browser_view.h" |
| 13 #include "chrome/browser/ui/panels/panel_manager.h" | 14 #include "chrome/browser/ui/panels/panel_manager.h" |
| 14 #include "chrome/browser/ui/panels/panel_settings_menu_model.h" | 15 #include "chrome/browser/ui/panels/panel_settings_menu_model.h" |
| 15 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 16 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
| 17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 18 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
| 19 #include "grit/theme_resources_standard.h" | 20 #include "grit/theme_resources_standard.h" |
| 20 #include "grit/ui_resources.h" | 21 #include "grit/ui_resources.h" |
| 21 #include "third_party/skia/include/effects/SkGradientShader.h" | 22 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 22 #include "ui/base/accessibility/accessible_view_state.h" | 23 #include "ui/base/accessibility/accessible_view_state.h" |
| 23 #include "ui/base/animation/slide_animation.h" | 24 #include "ui/base/animation/slide_animation.h" |
| 24 #include "ui/base/hit_test.h" | 25 #include "ui/base/hit_test.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 27 #include "ui/gfx/canvas_skia.h" | 28 #include "ui/gfx/canvas_skia.h" |
| 28 #include "ui/gfx/path.h" | 29 #include "ui/gfx/path.h" |
| 29 #include "ui/gfx/screen.h" | 30 #include "ui/gfx/screen.h" |
| 31 #include "ui/gfx/skia_util.h" |
| 30 #include "ui/views/controls/button/image_button.h" | 32 #include "ui/views/controls/button/image_button.h" |
| 31 #include "ui/views/controls/button/menu_button.h" | 33 #include "ui/views/controls/button/menu_button.h" |
| 32 #include "ui/views/controls/label.h" | 34 #include "ui/views/controls/label.h" |
| 33 #include "ui/views/controls/menu/menu_item_view.h" | 35 #include "ui/views/controls/menu/menu_item_view.h" |
| 34 #include "ui/views/controls/menu/menu_model_adapter.h" | 36 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 35 #include "ui/views/controls/menu/menu_runner.h" | 37 #include "ui/views/controls/menu/menu_runner.h" |
| 36 #include "ui/views/widget/widget_delegate.h" | 38 #include "ui/views/widget/widget_delegate.h" |
| 37 #include "views/painter.h" | 39 #include "views/painter.h" |
| 38 | 40 |
| 39 namespace { | 41 namespace { |
| 40 | 42 |
| 41 // The height in pixels of the titlebar. | 43 // The height in pixels of the titlebar. |
| 42 const int kTitlebarHeight = 24; | 44 const int kTitlebarHeight = 24; |
| 43 | 45 |
| 44 // The thickness in pixels of the frame border. | 46 // The thickness in pixels of the border. |
| 45 const int kFrameBorderThickness = 1; | 47 const int kBorderThickness = 1; |
| 46 | 48 |
| 47 // The spacing in pixels between the icon and the border/text. | 49 // No client edge is present. |
| 48 const int kIconSpacing = 4; | 50 const int kPanelClientEdgeThickness = 0; |
| 51 |
| 52 // The spacing in pixels between the icon and the left border. |
| 53 const int kIconAndBorderSpacing = 4; |
| 49 | 54 |
| 50 // The height and width in pixels of the icon. | 55 // The height and width in pixels of the icon. |
| 51 const int kIconSize = 16; | 56 const int kIconSize = 16; |
| 52 | 57 |
| 53 // The spacing in pixels between buttons or the button and the adjacent control. | 58 // The spacing in pixels between the title and the icon on the left, or the |
| 54 const int kButtonSpacing = 6; | 59 // button on the right. |
| 60 const int kTitleSpacing = 8; |
| 61 |
| 62 // The spacing in pixels between the close button and the right border. |
| 63 const int kCloseButtonAndBorderSpacing = 8; |
| 64 |
| 65 // The spacing in pixels between the close button and the settings button. |
| 66 const int kSettingsButtonAndCloseButtonSpacing = 8; |
| 55 | 67 |
| 56 // This value is experimental and subjective. | 68 // This value is experimental and subjective. |
| 57 const int kUpdateSettingsVisibilityAnimationMs = 120; | 69 const int kUpdateSettingsVisibilityAnimationMs = 120; |
| 58 | 70 |
| 59 // Colors used in painting the titlebar for drawing attention. | 71 // Colors used to draw active titlebar under default theme. |
| 60 const SkColor kBackgroundColorForAttention = 0xfffa983a; | 72 const SkColor kActiveTitleTextDefaultColor = SK_ColorBLACK; |
| 61 const SkColor kTitleTextColorForAttention = SK_ColorWHITE; | 73 const SkColor kActiveBackgroundDefaultColorStart = 0xfff0f8fa; |
| 74 const SkColor kActiveBackgroundDefaultColorEnd = 0xffc1d2dd; |
| 75 |
| 76 // Colors used to draw inactive titlebar under default theme. |
| 77 const SkColor kInactiveTitleTextDefaultColor = 0x80888888; |
| 78 const SkColor kInactiveBackgroundDefaultColorStart = 0xffffffff; |
| 79 const SkColor kInactiveBackgroundDefaultColorEnd = 0xffe7edf1; |
| 80 |
| 81 // Alpha value used in drawing inactive titlebar under default theme. |
| 82 const U8CPU kInactiveAlphaBlending = 0x80; |
| 83 |
| 84 // Colors used to draw titlebar for drawing attention under default theme. |
| 85 // It is also used in non-default theme since attention color is not defined |
| 86 // in the theme. |
| 87 const SkColor kAttentionTitleTextDefaultColor = SK_ColorWHITE; |
| 88 const SkColor kAttentionBackgroundDefaultColorStart = 0xffffab57; |
| 89 const SkColor kAttentionBackgroundDefaultColorEnd = 0xfff59338; |
| 90 |
| 91 // Color used to draw the border. |
| 92 const SkColor kBorderColor = 0xc0000000; |
| 93 |
| 94 // Color used to draw the divider line between the titlebar and the client area. |
| 95 const SkColor kDividerColor = 0xffb5b5b5; |
| 62 | 96 |
| 63 struct ButtonResources { | 97 struct ButtonResources { |
| 64 SkBitmap* normal_image; | 98 SkBitmap* normal_image; |
| 65 SkBitmap* mask_image; | 99 SkBitmap* mask_image; |
| 66 SkBitmap* hover_image; | 100 SkBitmap* hover_image; |
| 67 SkBitmap* pushed_image; | 101 SkBitmap* pushed_image; |
| 68 | 102 |
| 69 void SetResources(int normal_image_id, int mask_image_id, int hover_image_id, | 103 ButtonResources(int normal_image_id, int mask_image_id, int hover_image_id, |
| 70 int pushed_image_id) { | 104 int pushed_image_id) |
| 105 : normal_image(NULL), |
| 106 mask_image(NULL), |
| 107 hover_image(NULL), |
| 108 pushed_image(NULL) { |
| 71 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 109 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 72 normal_image = rb.GetBitmapNamed(normal_image_id); | 110 normal_image = rb.GetBitmapNamed(normal_image_id); |
| 73 mask_image = mask_image_id ? rb.GetBitmapNamed(mask_image_id) : NULL; | 111 mask_image = mask_image_id ? rb.GetBitmapNamed(mask_image_id) : NULL; |
| 74 hover_image = rb.GetBitmapNamed(hover_image_id); | 112 hover_image = rb.GetBitmapNamed(hover_image_id); |
| 75 pushed_image = rb.GetBitmapNamed(pushed_image_id); | 113 pushed_image = rb.GetBitmapNamed(pushed_image_id); |
| 76 } | 114 } |
| 77 }; | 115 }; |
| 78 | 116 |
| 79 struct EdgeResources { | 117 struct EdgeResources { |
| 80 SkBitmap* top_left; | 118 SkBitmap* top_left; |
| 81 SkBitmap* top; | 119 SkBitmap* top; |
| 82 SkBitmap* top_right; | 120 SkBitmap* top_right; |
| 83 SkBitmap* right; | 121 SkBitmap* right; |
| 84 SkBitmap* bottom_right; | 122 SkBitmap* bottom_right; |
| 85 SkBitmap* bottom; | 123 SkBitmap* bottom; |
| 86 SkBitmap* bottom_left; | 124 SkBitmap* bottom_left; |
| 87 SkBitmap* left; | 125 SkBitmap* left; |
| 88 | 126 |
| 89 void SetResources(int top_left_id, int top_id, int top_right_id, int right_id, | 127 EdgeResources(int top_left_id, int top_id, int top_right_id, int right_id, |
| 90 int bottom_right_id, int bottom_id, int bottom_left_id, | 128 int bottom_right_id, int bottom_id, int bottom_left_id, |
| 91 int left_id) { | 129 int left_id) |
| 130 : top_left(NULL), |
| 131 top(NULL), |
| 132 top_right(NULL), |
| 133 right(NULL), |
| 134 bottom_right(NULL), |
| 135 bottom(NULL), |
| 136 bottom_left(NULL), |
| 137 left(NULL) { |
| 92 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 138 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 93 top_left = rb.GetBitmapNamed(top_left_id); | 139 top_left = rb.GetBitmapNamed(top_left_id); |
| 94 top = rb.GetBitmapNamed(top_id); | 140 top = rb.GetBitmapNamed(top_id); |
| 95 top_right = rb.GetBitmapNamed(top_right_id); | 141 top_right = rb.GetBitmapNamed(top_right_id); |
| 96 right = rb.GetBitmapNamed(right_id); | 142 right = rb.GetBitmapNamed(right_id); |
| 97 bottom_right = rb.GetBitmapNamed(bottom_right_id); | 143 bottom_right = rb.GetBitmapNamed(bottom_right_id); |
| 98 bottom = rb.GetBitmapNamed(bottom_id); | 144 bottom = rb.GetBitmapNamed(bottom_id); |
| 99 bottom_left = rb.GetBitmapNamed(bottom_left_id); | 145 bottom_left = rb.GetBitmapNamed(bottom_left_id); |
| 100 left = rb.GetBitmapNamed(left_id); | 146 left = rb.GetBitmapNamed(left_id); |
| 101 } | 147 } |
| 102 }; | 148 }; |
| 103 | 149 |
| 104 ButtonResources settings_button_resources; | 150 SkPaint* CreateGradientPaint(SkColor start_color, SkColor end_color) { |
| 105 ButtonResources close_button_resources; | 151 SkShader* shader = gfx::CreateGradientShader( |
| 106 EdgeResources frame_edges; | 152 0, kTitlebarHeight, start_color, end_color); |
| 107 EdgeResources client_edges; | 153 SkPaint* paint = new SkPaint(); |
| 108 gfx::Font* title_font = NULL; | 154 paint->setStyle(SkPaint::kFill_Style); |
| 109 SkBitmap* background_bitmap_for_attention = NULL; | 155 paint->setAntiAlias(true); |
| 110 | 156 paint->setShader(shader); |
| 111 void LoadImageResources() { | 157 shader->unref(); |
| 112 settings_button_resources.SetResources( | 158 return paint; |
| 113 IDR_BALLOON_WRENCH, 0, IDR_BALLOON_WRENCH_H, IDR_BALLOON_WRENCH_P); | |
| 114 | |
| 115 close_button_resources.SetResources( | |
| 116 IDR_TAB_CLOSE, IDR_TAB_CLOSE_MASK, IDR_TAB_CLOSE_H, IDR_TAB_CLOSE_P); | |
| 117 | |
| 118 frame_edges.SetResources( | |
| 119 IDR_WINDOW_TOP_LEFT_CORNER, IDR_WINDOW_TOP_CENTER, | |
| 120 IDR_WINDOW_TOP_RIGHT_CORNER, IDR_WINDOW_RIGHT_SIDE, | |
| 121 IDR_PANEL_BOTTOM_RIGHT_CORNER, IDR_WINDOW_BOTTOM_CENTER, | |
| 122 IDR_PANEL_BOTTOM_LEFT_CORNER, IDR_WINDOW_LEFT_SIDE); | |
| 123 | |
| 124 client_edges.SetResources( | |
| 125 IDR_APP_TOP_LEFT, IDR_APP_TOP_CENTER, | |
| 126 IDR_APP_TOP_RIGHT, IDR_CONTENT_RIGHT_SIDE, | |
| 127 IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, | |
| 128 IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE); | |
| 129 } | 159 } |
| 130 | 160 |
| 131 void EnsureResourcesInitialized() { | 161 const ButtonResources& GetSettingsButtonResources() { |
| 132 static bool resources_initialized = false; | 162 static ButtonResources* buttons = NULL; |
| 133 if (resources_initialized) | 163 if (!buttons) { |
| 134 return; | 164 buttons = new ButtonResources(IDR_BALLOON_WRENCH, 0, |
| 135 resources_initialized = true; | 165 IDR_BALLOON_WRENCH_H, IDR_BALLOON_WRENCH_P); |
| 166 } |
| 167 return *buttons; |
| 168 } |
| 136 | 169 |
| 137 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 170 const ButtonResources& GetCloseButtonResources() { |
| 138 title_font = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont)); | 171 static ButtonResources* buttons = NULL; |
| 172 if (!buttons) { |
| 173 buttons = new ButtonResources(IDR_TAB_CLOSE, IDR_TAB_CLOSE_MASK, |
| 174 IDR_TAB_CLOSE_H, IDR_TAB_CLOSE_P); |
| 175 } |
| 176 return *buttons; |
| 177 } |
| 139 | 178 |
| 140 // Creates a bitmap of the specified color. | 179 const EdgeResources& GetFrameEdges() { |
| 141 background_bitmap_for_attention = new SkBitmap(); | 180 static EdgeResources* edges = NULL; |
| 142 background_bitmap_for_attention->setConfig( | 181 if (!edges) { |
| 143 SkBitmap::kARGB_8888_Config, 16, 16); | 182 edges = new EdgeResources( |
| 144 background_bitmap_for_attention->allocPixels(); | 183 IDR_WINDOW_TOP_LEFT_CORNER, IDR_WINDOW_TOP_CENTER, |
| 145 background_bitmap_for_attention->eraseColor(kBackgroundColorForAttention); | 184 IDR_WINDOW_TOP_RIGHT_CORNER, IDR_WINDOW_RIGHT_SIDE, |
| 185 IDR_PANEL_BOTTOM_RIGHT_CORNER, IDR_WINDOW_BOTTOM_CENTER, |
| 186 IDR_PANEL_BOTTOM_LEFT_CORNER, IDR_WINDOW_LEFT_SIDE); |
| 187 } |
| 188 return *edges; |
| 189 } |
| 146 | 190 |
| 147 LoadImageResources(); | 191 const gfx::Font& GetTitleFont() { |
| 192 static gfx::Font* font = NULL; |
| 193 if (!font) { |
| 194 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 195 font = new gfx::Font(rb.GetFont(ResourceBundle::BoldFont)); |
| 196 } |
| 197 return *font; |
| 198 } |
| 199 |
| 200 const SkPaint& GetActiveBackgroundDefaultPaint() { |
| 201 static SkPaint* paint = NULL; |
| 202 if (!paint) { |
| 203 paint = CreateGradientPaint(kActiveBackgroundDefaultColorStart, |
| 204 kActiveBackgroundDefaultColorEnd); |
| 205 } |
| 206 return *paint; |
| 207 } |
| 208 |
| 209 const SkPaint& GetInactiveBackgroundDefaultPaint() { |
| 210 static SkPaint* paint = NULL; |
| 211 if (!paint) { |
| 212 paint = CreateGradientPaint(kInactiveBackgroundDefaultColorStart, |
| 213 kInactiveBackgroundDefaultColorEnd); |
| 214 } |
| 215 return *paint; |
| 216 } |
| 217 |
| 218 const SkPaint& GetAttentionBackgroundDefaultPaint() { |
| 219 static SkPaint* paint = NULL; |
| 220 if (!paint) { |
| 221 paint = CreateGradientPaint(kAttentionBackgroundDefaultColorStart, |
| 222 kAttentionBackgroundDefaultColorEnd); |
| 223 } |
| 224 return *paint; |
| 148 } | 225 } |
| 149 | 226 |
| 150 } // namespace | 227 } // namespace |
| 151 | 228 |
| 152 // PanelBrowserFrameView::MouseWatcher ----------------------------------------- | 229 // PanelBrowserFrameView::MouseWatcher ----------------------------------------- |
| 153 | 230 |
| 154 PanelBrowserFrameView::MouseWatcher::MouseWatcher(PanelBrowserFrameView* view) | 231 PanelBrowserFrameView::MouseWatcher::MouseWatcher(PanelBrowserFrameView* view) |
| 155 : view_(view), | 232 : view_(view), |
| 156 is_mouse_within_(false) { | 233 is_mouse_within_(false) { |
| 157 MessageLoopForUI::current()->AddObserver(this); | 234 MessageLoopForUI::current()->AddObserver(this); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 PanelBrowserFrameView::PanelBrowserFrameView(BrowserFrame* frame, | 309 PanelBrowserFrameView::PanelBrowserFrameView(BrowserFrame* frame, |
| 233 PanelBrowserView* browser_view) | 310 PanelBrowserView* browser_view) |
| 234 : BrowserNonClientFrameView(frame, browser_view), | 311 : BrowserNonClientFrameView(frame, browser_view), |
| 235 panel_browser_view_(browser_view), | 312 panel_browser_view_(browser_view), |
| 236 paint_state_(NOT_PAINTED), | 313 paint_state_(NOT_PAINTED), |
| 237 settings_button_(NULL), | 314 settings_button_(NULL), |
| 238 close_button_(NULL), | 315 close_button_(NULL), |
| 239 title_icon_(NULL), | 316 title_icon_(NULL), |
| 240 title_label_(NULL), | 317 title_label_(NULL), |
| 241 is_settings_button_visible_(false) { | 318 is_settings_button_visible_(false) { |
| 242 EnsureResourcesInitialized(); | |
| 243 frame->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); | 319 frame->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); |
| 244 | 320 |
| 321 const ButtonResources& settings_button_resources = |
| 322 GetSettingsButtonResources(); |
| 245 settings_button_ = new views::MenuButton(NULL, string16(), this, false); | 323 settings_button_ = new views::MenuButton(NULL, string16(), this, false); |
| 246 settings_button_->SetIcon(*(settings_button_resources.normal_image)); | 324 settings_button_->SetIcon(*(settings_button_resources.normal_image)); |
| 247 settings_button_->SetHoverIcon(*(settings_button_resources.hover_image)); | 325 settings_button_->SetHoverIcon(*(settings_button_resources.hover_image)); |
| 248 settings_button_->SetPushedIcon(*(settings_button_resources.pushed_image)); | 326 settings_button_->SetPushedIcon(*(settings_button_resources.pushed_image)); |
| 249 settings_button_->set_alignment(views::TextButton::ALIGN_CENTER); | 327 settings_button_->set_alignment(views::TextButton::ALIGN_CENTER); |
| 250 settings_button_->set_border(NULL); | 328 settings_button_->set_border(NULL); |
| 251 settings_button_->SetTooltipText( | 329 settings_button_->SetTooltipText( |
| 252 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_SETTINGS)); | 330 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_SETTINGS)); |
| 253 settings_button_->SetAccessibleName( | 331 settings_button_->SetAccessibleName( |
| 254 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_SETTINGS)); | 332 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_SETTINGS)); |
| 255 settings_button_->SetVisible(is_settings_button_visible_); | 333 settings_button_->SetVisible(is_settings_button_visible_); |
| 256 AddChildView(settings_button_); | 334 AddChildView(settings_button_); |
| 257 | 335 |
| 336 const ButtonResources& close_button_resources = GetCloseButtonResources(); |
| 258 close_button_ = new views::ImageButton(this); | 337 close_button_ = new views::ImageButton(this); |
| 259 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 338 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
| 260 close_button_resources.normal_image); | 339 close_button_resources.normal_image); |
| 261 close_button_->SetImage(views::CustomButton::BS_HOT, | 340 close_button_->SetImage(views::CustomButton::BS_HOT, |
| 262 close_button_resources.hover_image); | 341 close_button_resources.hover_image); |
| 263 close_button_->SetImage(views::CustomButton::BS_PUSHED, | 342 close_button_->SetImage(views::CustomButton::BS_PUSHED, |
| 264 close_button_resources.pushed_image); | 343 close_button_resources.pushed_image); |
| 265 close_button_->SetTooltipText( | 344 close_button_->SetTooltipText( |
| 266 l10n_util::GetStringUTF16(IDS_TOOLTIP_CLOSE_TAB)); | 345 l10n_util::GetStringUTF16(IDS_TOOLTIP_CLOSE_TAB)); |
| 267 close_button_->SetAccessibleName( | 346 close_button_->SetAccessibleName( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 int window_component = GetHTComponentForFrame(point, | 412 int window_component = GetHTComponentForFrame(point, |
| 334 NonClientBorderThickness(), NonClientBorderThickness(), | 413 NonClientBorderThickness(), NonClientBorderThickness(), |
| 335 0, 0, | 414 0, 0, |
| 336 frame()->widget_delegate()->CanResize()); | 415 frame()->widget_delegate()->CanResize()); |
| 337 // Fall back to the caption if no other component matches. | 416 // Fall back to the caption if no other component matches. |
| 338 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; | 417 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; |
| 339 } | 418 } |
| 340 | 419 |
| 341 void PanelBrowserFrameView::GetWindowMask(const gfx::Size& size, | 420 void PanelBrowserFrameView::GetWindowMask(const gfx::Size& size, |
| 342 gfx::Path* window_mask) { | 421 gfx::Path* window_mask) { |
| 343 // For panel, the window shape is rectangle with top-left and top-right | 422 window_mask->moveTo(0, 3); |
| 344 // corners rounded. | 423 window_mask->lineTo(1, 2); |
| 345 if (size.height() <= Panel::kMinimizedPanelHeight) { | 424 window_mask->lineTo(1, 1); |
| 346 // For minimize panel, we need to produce the window mask applicable to | 425 window_mask->lineTo(2, 1); |
| 347 // the 3-pixel lines. | 426 window_mask->lineTo(3, 0); |
| 348 window_mask->moveTo(0, SkIntToScalar(size.height())); | 427 window_mask->lineTo(SkIntToScalar(size.width() - 3), 0); |
| 349 window_mask->lineTo(0, 1); | 428 window_mask->lineTo(SkIntToScalar(size.width() - 2), 1); |
| 350 window_mask->lineTo(1, 0); | 429 window_mask->lineTo(SkIntToScalar(size.width() - 1), 1); |
| 351 window_mask->lineTo(SkIntToScalar(size.width()) - 1, 0); | 430 window_mask->lineTo(SkIntToScalar(size.width() - 1), 2); |
| 352 window_mask->lineTo(SkIntToScalar(size.width()), 1); | 431 window_mask->lineTo(SkIntToScalar(size.width() - 1), 3); |
| 353 window_mask->lineTo(SkIntToScalar(size.width()), | 432 window_mask->lineTo(SkIntToScalar(size.width()), |
| 354 SkIntToScalar(size.height())); | 433 SkIntToScalar(size.height())); |
| 355 } else { | 434 window_mask->lineTo(0, SkIntToScalar(size.height())); |
| 356 window_mask->moveTo(0, 3); | |
| 357 window_mask->lineTo(1, 2); | |
| 358 window_mask->lineTo(1, 1); | |
| 359 window_mask->lineTo(2, 1); | |
| 360 window_mask->lineTo(3, 0); | |
| 361 window_mask->lineTo(SkIntToScalar(size.width() - 3), 0); | |
| 362 window_mask->lineTo(SkIntToScalar(size.width() - 2), 1); | |
| 363 window_mask->lineTo(SkIntToScalar(size.width() - 1), 1); | |
| 364 window_mask->lineTo(SkIntToScalar(size.width() - 1), 2); | |
| 365 window_mask->lineTo(SkIntToScalar(size.width()), 3); | |
| 366 window_mask->lineTo(SkIntToScalar(size.width()), | |
| 367 SkIntToScalar(size.height())); | |
| 368 window_mask->lineTo(0, SkIntToScalar(size.height())); | |
| 369 } | |
| 370 window_mask->close(); | 435 window_mask->close(); |
| 371 } | 436 } |
| 372 | 437 |
| 373 void PanelBrowserFrameView::ResetWindowControls() { | 438 void PanelBrowserFrameView::ResetWindowControls() { |
| 374 // The close button isn't affected by this constraint. | 439 // The close button isn't affected by this constraint. |
| 375 } | 440 } |
| 376 | 441 |
| 377 void PanelBrowserFrameView::UpdateWindowIcon() { | 442 void PanelBrowserFrameView::UpdateWindowIcon() { |
| 378 title_icon_->SchedulePaint(); | 443 title_icon_->SchedulePaint(); |
| 379 } | 444 } |
| 380 | 445 |
| 381 void PanelBrowserFrameView::OnPaint(gfx::Canvas* canvas) { | 446 void PanelBrowserFrameView::OnPaint(gfx::Canvas* canvas) { |
| 382 // The font and color need to be updated depending on the panel's state. | 447 // The font and color need to be updated depending on the panel's state. |
| 383 PaintState paint_state; | 448 PaintState paint_state; |
| 384 if (panel_browser_view_->panel()->IsDrawingAttention()) | 449 if (panel_browser_view_->panel()->IsDrawingAttention()) |
| 385 paint_state = PAINT_FOR_ATTENTION; | 450 paint_state = PAINT_FOR_ATTENTION; |
| 386 else if (panel_browser_view_->focused()) | 451 else if (panel_browser_view_->focused()) |
| 387 paint_state = PAINT_AS_ACTIVE; | 452 paint_state = PAINT_AS_ACTIVE; |
| 388 else | 453 else |
| 389 paint_state = PAINT_AS_INACTIVE; | 454 paint_state = PAINT_AS_INACTIVE; |
| 390 | 455 |
| 391 UpdateControlStyles(paint_state); | 456 UpdateControlStyles(paint_state); |
| 392 PaintFrameBorder(canvas); | 457 PaintFrameBorder(canvas); |
| 393 PaintClientEdge(canvas); | |
| 394 } | 458 } |
| 395 | 459 |
| 396 void PanelBrowserFrameView::OnThemeChanged() { | 460 void PanelBrowserFrameView::OnThemeChanged() { |
| 397 LoadImageResources(); | |
| 398 } | 461 } |
| 399 | 462 |
| 400 gfx::Size PanelBrowserFrameView::GetMinimumSize() { | 463 gfx::Size PanelBrowserFrameView::GetMinimumSize() { |
| 401 // This makes the panel be able to shrink to very small, like 3-pixel lines. | 464 // This makes the panel be able to shrink to very small, like 4-pixel lines. |
| 402 // Since the panel cannot be resized by the user, we do not need to enforce | 465 // Since the panel cannot be resized by the user, we do not need to enforce |
| 403 // the minimum size. | 466 // the minimum size. |
| 404 return gfx::Size(); | 467 return gfx::Size(); |
| 405 } | 468 } |
| 406 | 469 |
| 407 void PanelBrowserFrameView::Layout() { | 470 void PanelBrowserFrameView::Layout() { |
| 408 // Cancel the settings button animation if the layout of titlebar is being | 471 // Cancel the settings button animation if the layout of titlebar is being |
| 409 // updated. | 472 // updated. |
| 410 if (settings_button_animator_.get() && settings_button_animator_->IsShowing()) | 473 if (settings_button_animator_.get() && settings_button_animator_->IsShowing()) |
| 411 settings_button_animator_->Reset(); | 474 settings_button_animator_->Reset(); |
| 412 | 475 |
| 413 // Layout the close button. | 476 // Layout the close button. |
| 414 gfx::Size close_button_size = close_button_->GetPreferredSize(); | 477 gfx::Size close_button_size = close_button_->GetPreferredSize(); |
| 415 close_button_->SetBounds( | 478 close_button_->SetBounds( |
| 416 width() - kFrameBorderThickness - kButtonSpacing - | 479 width() - kBorderThickness - kCloseButtonAndBorderSpacing - |
| 417 close_button_size.width(), | 480 close_button_size.width(), |
| 418 (NonClientTopBorderHeight() - close_button_size.height()) / 2, | 481 (NonClientTopBorderHeight() - close_button_size.height()) / 2, |
| 419 close_button_size.width(), | 482 close_button_size.width(), |
| 420 close_button_size.height()); | 483 close_button_size.height()); |
| 421 | 484 |
| 422 // Layout the settings button. | 485 // Layout the settings button. |
| 423 gfx::Size settings_button_size = settings_button_->GetPreferredSize(); | 486 gfx::Size settings_button_size = settings_button_->GetPreferredSize(); |
| 424 settings_button_->SetBounds( | 487 settings_button_->SetBounds( |
| 425 close_button_->x() - kButtonSpacing - settings_button_size.width(), | 488 close_button_->x() - kSettingsButtonAndCloseButtonSpacing - |
| 489 settings_button_size.width(), |
| 426 (NonClientTopBorderHeight() - settings_button_size.height()) / 2, | 490 (NonClientTopBorderHeight() - settings_button_size.height()) / 2, |
| 427 settings_button_size.width(), | 491 settings_button_size.width(), |
| 428 settings_button_size.height()); | 492 settings_button_size.height()); |
| 429 | 493 |
| 430 // Trace the full bounds and zero-size bounds for animation purpose. | 494 // Trace the full bounds and zero-size bounds for animation purpose. |
| 431 settings_button_full_bounds_ = settings_button_->bounds(); | 495 settings_button_full_bounds_ = settings_button_->bounds(); |
| 432 settings_button_zero_bounds_.SetRect( | 496 settings_button_zero_bounds_.SetRect( |
| 433 settings_button_full_bounds_.x() + | 497 settings_button_full_bounds_.x() + |
| 434 settings_button_full_bounds_.width() / 2, | 498 settings_button_full_bounds_.width() / 2, |
| 435 settings_button_full_bounds_.y() + | 499 settings_button_full_bounds_.y() + |
| 436 settings_button_full_bounds_.height() / 2, | 500 settings_button_full_bounds_.height() / 2, |
| 437 0, | 501 0, |
| 438 0); | 502 0); |
| 439 | 503 |
| 440 // Layout the icon. | 504 // Layout the icon. |
| 441 int icon_y = (NonClientTopBorderHeight() - kIconSize) / 2; | 505 int icon_y = (NonClientTopBorderHeight() - kIconSize) / 2; |
| 442 title_icon_->SetBounds( | 506 title_icon_->SetBounds( |
| 443 kFrameBorderThickness + kIconSpacing, | 507 kBorderThickness + kIconAndBorderSpacing, |
| 444 icon_y, | 508 icon_y, |
| 445 kIconSize, | 509 kIconSize, |
| 446 kIconSize); | 510 kIconSize); |
| 447 | 511 |
| 448 // Layout the title. | 512 // Layout the title. |
| 449 int title_x = title_icon_->bounds().right() + kIconSpacing; | 513 int title_x = title_icon_->bounds().right() + kTitleSpacing; |
| 450 int title_height = BrowserFrame::GetTitleFont().GetHeight(); | 514 int title_height = BrowserFrame::GetTitleFont().GetHeight(); |
| 451 title_label_->SetBounds( | 515 title_label_->SetBounds( |
| 452 title_x, | 516 title_x, |
| 453 icon_y + ((kIconSize - title_height - 1) / 2), | 517 icon_y + ((kIconSize - title_height - 1) / 2), |
| 454 std::max(0, settings_button_->x() - kButtonSpacing - title_x), | 518 std::max(0, settings_button_->x() - kTitleSpacing - title_x), |
| 455 title_height); | 519 title_height); |
| 456 | 520 |
| 457 // Calculate the client area bounds. | 521 // Calculate the client area bounds. |
| 458 int top_height = NonClientTopBorderHeight(); | 522 int top_height = NonClientTopBorderHeight(); |
| 459 int border_thickness = NonClientBorderThickness(); | 523 int border_thickness = NonClientBorderThickness(); |
| 460 client_view_bounds_.SetRect( | 524 client_view_bounds_.SetRect( |
| 461 border_thickness, | 525 border_thickness, |
| 462 top_height, | 526 top_height, |
| 463 std::max(0, width() - (2 * border_thickness)), | 527 std::max(0, width() - (2 * border_thickness)), |
| 464 std::max(0, height() - top_height - border_thickness)); | 528 std::max(0, height() - top_height - border_thickness)); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 AnimationEnded(animation); | 610 AnimationEnded(animation); |
| 547 else | 611 else |
| 548 settings_button_->SetBoundsRect(new_bounds); | 612 settings_button_->SetBoundsRect(new_bounds); |
| 549 } | 613 } |
| 550 | 614 |
| 551 void PanelBrowserFrameView::AnimationCanceled(const ui::Animation* animation) { | 615 void PanelBrowserFrameView::AnimationCanceled(const ui::Animation* animation) { |
| 552 AnimationEnded(animation); | 616 AnimationEnded(animation); |
| 553 } | 617 } |
| 554 | 618 |
| 555 int PanelBrowserFrameView::NonClientBorderThickness() const { | 619 int PanelBrowserFrameView::NonClientBorderThickness() const { |
| 556 return kFrameBorderThickness + kClientEdgeThickness; | 620 return kBorderThickness + kPanelClientEdgeThickness; |
| 557 } | 621 } |
| 558 | 622 |
| 559 int PanelBrowserFrameView::NonClientTopBorderHeight() const { | 623 int PanelBrowserFrameView::NonClientTopBorderHeight() const { |
| 560 return kFrameBorderThickness + kTitlebarHeight + kClientEdgeThickness; | 624 return kBorderThickness + kTitlebarHeight + kPanelClientEdgeThickness; |
| 561 } | 625 } |
| 562 | 626 |
| 563 gfx::Size PanelBrowserFrameView::NonClientAreaSize() const { | 627 gfx::Size PanelBrowserFrameView::NonClientAreaSize() const { |
| 564 return gfx::Size(NonClientBorderThickness() * 2, | 628 return gfx::Size(NonClientBorderThickness() * 2, |
| 565 NonClientTopBorderHeight() + NonClientBorderThickness()); | 629 NonClientTopBorderHeight() + NonClientBorderThickness()); |
| 566 } | 630 } |
| 567 | 631 |
| 568 SkColor PanelBrowserFrameView::GetTitleColor(PaintState paint_state) const { | 632 bool PanelBrowserFrameView::UsingDefaultTheme() const { |
| 633 ThemeService* theme_service = ThemeServiceFactory::GetForProfile( |
| 634 panel_browser_view_->panel()->browser()->profile()); |
| 635 return theme_service->UsingDefaultTheme(); |
| 636 } |
| 637 |
| 638 SkColor PanelBrowserFrameView::GetDefaultTitleColor( |
| 639 PaintState paint_state) const { |
| 569 switch (paint_state) { | 640 switch (paint_state) { |
| 570 case PAINT_AS_INACTIVE: | 641 case PAINT_AS_INACTIVE: |
| 571 return GetThemeProvider()->GetColor( | 642 return kActiveTitleTextDefaultColor; |
| 572 ThemeService::COLOR_BACKGROUND_TAB_TEXT); | |
| 573 case PAINT_AS_ACTIVE: | 643 case PAINT_AS_ACTIVE: |
| 574 return GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT); | 644 return kInactiveTitleTextDefaultColor; |
| 575 case PAINT_FOR_ATTENTION: | 645 case PAINT_FOR_ATTENTION: |
| 576 return kTitleTextColorForAttention; | 646 return kAttentionTitleTextDefaultColor; |
| 577 default: | 647 default: |
| 578 NOTREACHED(); | 648 NOTREACHED(); |
| 579 return SkColor(); | 649 return SkColor(); |
| 580 } | 650 } |
| 581 } | 651 } |
| 582 | 652 |
| 583 gfx::Font* PanelBrowserFrameView::GetTitleFont() const { | 653 SkColor PanelBrowserFrameView::GetTitleColor(PaintState paint_state) const { |
| 584 return title_font; | 654 switch (paint_state) { |
| 655 case PAINT_AS_INACTIVE: |
| 656 return SkColorSetA( |
| 657 GetThemeProvider()->GetColor(ThemeService::COLOR_BACKGROUND_TAB_TEXT), |
| 658 kInactiveAlphaBlending); |
| 659 case PAINT_AS_ACTIVE: |
| 660 return GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT); |
| 661 case PAINT_FOR_ATTENTION: |
| 662 return kAttentionTitleTextDefaultColor; |
| 663 default: |
| 664 NOTREACHED(); |
| 665 return SkColor(); |
| 666 } |
| 667 } |
| 668 |
| 669 const SkPaint& PanelBrowserFrameView::GetDefaultFrameTheme( |
| 670 PaintState paint_state) const { |
| 671 switch (paint_state) { |
| 672 case PAINT_AS_INACTIVE: |
| 673 return GetInactiveBackgroundDefaultPaint(); |
| 674 case PAINT_AS_ACTIVE: |
| 675 return GetActiveBackgroundDefaultPaint(); |
| 676 case PAINT_FOR_ATTENTION: |
| 677 return GetAttentionBackgroundDefaultPaint(); |
| 678 default: |
| 679 NOTREACHED(); |
| 680 return GetInactiveBackgroundDefaultPaint(); |
| 681 } |
| 585 } | 682 } |
| 586 | 683 |
| 587 SkBitmap* PanelBrowserFrameView::GetFrameTheme(PaintState paint_state) const { | 684 SkBitmap* PanelBrowserFrameView::GetFrameTheme(PaintState paint_state) const { |
| 588 switch (paint_state) { | 685 switch (paint_state) { |
| 589 case PAINT_AS_INACTIVE: | 686 case PAINT_AS_INACTIVE: |
| 590 return GetThemeProvider()->GetBitmapNamed(IDR_THEME_TAB_BACKGROUND); | 687 return GetThemeProvider()->GetBitmapNamed(IDR_THEME_TAB_BACKGROUND); |
| 591 case PAINT_AS_ACTIVE: | 688 case PAINT_AS_ACTIVE: |
| 592 return GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR); | 689 return GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR); |
| 593 case PAINT_FOR_ATTENTION: | 690 case PAINT_FOR_ATTENTION: |
| 594 return background_bitmap_for_attention; | 691 // Background color for drawing attention is same regardless of the |
| 692 // theme. GetDefaultFrameTheme should be used. |
| 595 default: | 693 default: |
| 596 NOTREACHED(); | 694 NOTREACHED(); |
| 597 return NULL; | 695 return NULL; |
| 598 } | 696 } |
| 599 } | 697 } |
| 600 | 698 |
| 601 void PanelBrowserFrameView::UpdateControlStyles(PaintState paint_state) { | 699 void PanelBrowserFrameView::UpdateControlStyles(PaintState paint_state) { |
| 602 DCHECK(paint_state != NOT_PAINTED); | 700 DCHECK(paint_state != NOT_PAINTED); |
| 603 | 701 |
| 604 if (paint_state == paint_state_) | 702 if (paint_state == paint_state_) |
| 605 return; | 703 return; |
| 606 paint_state_ = paint_state; | 704 paint_state_ = paint_state; |
| 607 | 705 |
| 608 SkColor title_color = GetTitleColor(paint_state_); | 706 SkColor title_color = GetTitleColor(paint_state_); |
| 609 title_label_->SetEnabledColor(title_color); | 707 title_label_->SetEnabledColor(title_color); |
| 610 title_label_->SetFont(*GetTitleFont()); | 708 title_label_->SetFont(GetTitleFont()); |
| 611 | 709 |
| 612 close_button_->SetBackground(title_color, | 710 close_button_->SetBackground(title_color, |
| 613 close_button_resources.normal_image, | 711 GetCloseButtonResources().normal_image, |
| 614 close_button_resources.mask_image); | 712 GetCloseButtonResources().mask_image); |
| 615 } | 713 } |
| 616 | 714 |
| 617 void PanelBrowserFrameView::PaintFrameBorder(gfx::Canvas* canvas) { | 715 void PanelBrowserFrameView::PaintFrameBorder(gfx::Canvas* canvas) { |
| 618 SkBitmap* theme_frame = GetFrameTheme(paint_state_); | 716 // Paint the background. |
| 619 | 717 if (paint_state_ == PAINT_FOR_ATTENTION || UsingDefaultTheme()) { |
| 620 // Draw the theme frame. | 718 const SkPaint& paint = GetDefaultFrameTheme(paint_state_); |
| 621 canvas->TileImageInt(*theme_frame, 0, 0, width(), height()); | 719 canvas->DrawRectInt(0, 0, width(), kTitlebarHeight, paint); |
| 622 | 720 } else { |
| 623 // No need to paint other stuff if panel is minimized. | 721 SkBitmap* bitmap = GetFrameTheme(paint_state_); |
| 624 if (height() <= Panel::kMinimizedPanelHeight) | 722 canvas->TileImageInt(*bitmap, 0, 0, width(), kTitlebarHeight); |
| 625 return; | 723 } |
| 626 | 724 |
| 627 // Draw the top border. | 725 // Draw the top border. |
| 726 const EdgeResources& frame_edges = GetFrameEdges(); |
| 628 canvas->DrawBitmapInt(*(frame_edges.top_left), 0, 0); | 727 canvas->DrawBitmapInt(*(frame_edges.top_left), 0, 0); |
| 629 canvas->TileImageInt( | 728 canvas->TileImageInt( |
| 630 *(frame_edges.top), frame_edges.top_left->width(), 0, | 729 *(frame_edges.top), frame_edges.top_left->width(), 0, |
| 631 width() - frame_edges.top_right->width(), frame_edges.top->height()); | 730 width() - frame_edges.top_right->width(), frame_edges.top->height()); |
| 632 canvas->DrawBitmapInt( | 731 canvas->DrawBitmapInt( |
| 633 *(frame_edges.top_right), | 732 *(frame_edges.top_right), |
| 634 width() - frame_edges.top_right->width(), 0); | 733 width() - frame_edges.top_right->width(), 0); |
| 635 | 734 |
| 636 // Draw the right border. | 735 // Draw the right border. |
| 637 canvas->TileImageInt( | 736 canvas->TileImageInt( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 654 canvas->DrawBitmapInt( | 753 canvas->DrawBitmapInt( |
| 655 *(frame_edges.bottom_left), 0, | 754 *(frame_edges.bottom_left), 0, |
| 656 height() - frame_edges.bottom_left->height()); | 755 height() - frame_edges.bottom_left->height()); |
| 657 | 756 |
| 658 // Draw the left border. | 757 // Draw the left border. |
| 659 canvas->TileImageInt( | 758 canvas->TileImageInt( |
| 660 *(frame_edges.left), 0, frame_edges.top_left->height(), | 759 *(frame_edges.left), 0, frame_edges.top_left->height(), |
| 661 frame_edges.left->width(), | 760 frame_edges.left->width(), |
| 662 height() - frame_edges.top_left->height() - | 761 height() - frame_edges.top_left->height() - |
| 663 frame_edges.bottom_left->height()); | 762 frame_edges.bottom_left->height()); |
| 664 } | |
| 665 | 763 |
| 666 void PanelBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) { | 764 // Draw the divider between the titlebar and the client area. |
| 667 int client_area_top = client_view_bounds_.y(); | 765 if (height() > kTitlebarHeight) { |
| 668 | 766 canvas->DrawRectInt(kDividerColor, kBorderThickness, kTitlebarHeight, |
| 669 // No need to paint other stuff if panel is minimized. | 767 width() - 1 - 2 * kBorderThickness, kBorderThickness); |
| 670 if (height() <= Panel::kMinimizedPanelHeight) | 768 } |
| 671 return; | |
| 672 | |
| 673 // Draw the top edge. | |
| 674 int top_edge_y = client_area_top - client_edges.top->height(); | |
| 675 canvas->DrawBitmapInt( | |
| 676 *(client_edges.top_left), | |
| 677 client_view_bounds_.x() - client_edges.top_left->width(), | |
| 678 top_edge_y); | |
| 679 canvas->TileImageInt( | |
| 680 *(client_edges.top), client_view_bounds_.x(), top_edge_y, | |
| 681 client_view_bounds_.width(), client_edges.top->height()); | |
| 682 canvas->DrawBitmapInt( | |
| 683 *(client_edges.top_right), client_view_bounds_.right(), top_edge_y); | |
| 684 | |
| 685 // Draw the right edge. | |
| 686 int client_area_bottom = | |
| 687 std::max(client_area_top, client_view_bounds_.bottom()); | |
| 688 int client_area_height = client_area_bottom - client_area_top; | |
| 689 canvas->TileImageInt( | |
| 690 *(client_edges.right), client_view_bounds_.right(), client_area_top, | |
| 691 client_edges.right->width(), client_area_height); | |
| 692 | |
| 693 // Draw the bottom edge. | |
| 694 canvas->DrawBitmapInt( | |
| 695 *(client_edges.bottom_right), client_view_bounds_.right(), | |
| 696 client_area_bottom); | |
| 697 canvas->TileImageInt( | |
| 698 *(client_edges.bottom), client_view_bounds_.x(), client_area_bottom, | |
| 699 client_view_bounds_.width(), client_edges.bottom_right->height()); | |
| 700 canvas->DrawBitmapInt( | |
| 701 *(client_edges.bottom_left), | |
| 702 client_view_bounds_.x() - client_edges.bottom_left->width(), | |
| 703 client_area_bottom); | |
| 704 | |
| 705 // Draw the left edge. | |
| 706 canvas->TileImageInt( | |
| 707 *(client_edges.left), | |
| 708 client_view_bounds_.x() - client_edges.left->width(), | |
| 709 client_area_top, client_edges.left->width(), client_area_height); | |
| 710 } | 769 } |
| 711 | 770 |
| 712 string16 PanelBrowserFrameView::GetTitleText() const { | 771 string16 PanelBrowserFrameView::GetTitleText() const { |
| 713 return frame()->widget_delegate()->GetWindowTitle(); | 772 return frame()->widget_delegate()->GetWindowTitle(); |
| 714 } | 773 } |
| 715 | 774 |
| 716 void PanelBrowserFrameView::UpdateTitleBar() { | 775 void PanelBrowserFrameView::UpdateTitleBar() { |
| 717 title_label_->SetText(GetTitleText()); | 776 title_label_->SetText(GetTitleText()); |
| 718 } | 777 } |
| 719 | 778 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 | 824 |
| 766 settings_menu_model_.reset( | 825 settings_menu_model_.reset( |
| 767 new PanelSettingsMenuModel(panel_browser_view_->panel())); | 826 new PanelSettingsMenuModel(panel_browser_view_->panel())); |
| 768 settings_menu_adapter_.reset( | 827 settings_menu_adapter_.reset( |
| 769 new views::MenuModelAdapter(settings_menu_model_.get())); | 828 new views::MenuModelAdapter(settings_menu_model_.get())); |
| 770 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); | 829 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); |
| 771 settings_menu_adapter_->BuildMenu(settings_menu_); | 830 settings_menu_adapter_->BuildMenu(settings_menu_); |
| 772 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); | 831 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); |
| 773 return true; | 832 return true; |
| 774 } | 833 } |
| OLD | NEW |