| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/frame/opaque_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/opaque_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "app/theme_provider.h" | 9 #include "app/theme_provider.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "views/controls/image_view.h" | 25 #include "views/controls/image_view.h" |
| 26 #include "views/widget/root_view.h" | 26 #include "views/widget/root_view.h" |
| 27 #include "views/window/window.h" | 27 #include "views/window/window.h" |
| 28 #include "views/window/window_resources.h" | 28 #include "views/window/window_resources.h" |
| 29 #include "views/window/window_shape.h" | 29 #include "views/window/window_shape.h" |
| 30 | 30 |
| 31 #if defined(OS_LINUX) | 31 #if defined(OS_LINUX) |
| 32 #include "views/window/hit_test.h" | 32 #include "views/window/hit_test.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 #if defined(OS_CHROMEOS) | |
| 36 const int kCustomFrameBackgroundVerticalOffset = 15; | |
| 37 #endif | |
| 38 | |
| 39 namespace { | 35 namespace { |
| 40 // The frame border is only visible in restored mode and is hardcoded to 4 px on | 36 // The frame border is only visible in restored mode and is hardcoded to 4 px on |
| 41 // each side regardless of the system window border size. | 37 // each side regardless of the system window border size. |
| 42 const int kFrameBorderThickness = 4; | 38 const int kFrameBorderThickness = 4; |
| 43 // Besides the frame border, there's another 11 px of empty space atop the | 39 // Besides the frame border, there's another 11 px of empty space atop the |
| 44 // window in restored mode, to use to drag the window around. | 40 // window in restored mode, to use to drag the window around. |
| 45 const int kNonClientRestoredExtraThickness = 11; | 41 const int kNonClientRestoredExtraThickness = 11; |
| 46 // While resize areas on Windows are normally the same size as the window | 42 // While resize areas on Windows are normally the same size as the window |
| 47 // borders, our top area is shrunk by 1 px to make it easier to move the window | 43 // borders, our top area is shrunk by 1 px to make it easier to move the window |
| 48 // around with our thinner top grabbable strip. (Incidentally, our side and | 44 // around with our thinner top grabbable strip. (Incidentally, our side and |
| (...skipping 11 matching lines...) Expand all Loading... |
| 60 // The titlebar has a 2 px 3D edge along the top and bottom. | 56 // The titlebar has a 2 px 3D edge along the top and bottom. |
| 61 const int kTitlebarTopAndBottomEdgeThickness = 2; | 57 const int kTitlebarTopAndBottomEdgeThickness = 2; |
| 62 // The icon is inset 2 px from the left frame border. | 58 // The icon is inset 2 px from the left frame border. |
| 63 const int kIconLeftSpacing = 2; | 59 const int kIconLeftSpacing = 2; |
| 64 // The icon never shrinks below 16 px on a side. | 60 // The icon never shrinks below 16 px on a side. |
| 65 const int kIconMinimumSize = 16; | 61 const int kIconMinimumSize = 16; |
| 66 // There is a 4 px gap between the icon and the title text. | 62 // There is a 4 px gap between the icon and the title text. |
| 67 const int kIconTitleSpacing = 4; | 63 const int kIconTitleSpacing = 4; |
| 68 // There is a 5 px gap between the title text and the caption buttons. | 64 // There is a 5 px gap between the title text and the caption buttons. |
| 69 const int kTitleLogoSpacing = 5; | 65 const int kTitleLogoSpacing = 5; |
| 70 // In maximized mode, the OTR avatar starts 2 px below the top of the screen, so | |
| 71 // that it doesn't extend into the "3D edge" portion of the titlebar. | |
| 72 const int kOTRMaximizedTopSpacing = 2; | |
| 73 // The OTR avatar ends 2 px above the bottom of the tabstrip (which, given the | 66 // The OTR avatar ends 2 px above the bottom of the tabstrip (which, given the |
| 74 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the | 67 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the |
| 75 // user). | 68 // user). |
| 76 const int kOTRBottomSpacing = 2; | 69 const int kOTRBottomSpacing = 2; |
| 77 // There are 2 px on each side of the OTR avatar (between the frame border and | 70 // There are 2 px on each side of the OTR avatar (between the frame border and |
| 78 // it on the left, and between it and the tabstrip on the right). | 71 // it on the left, and between it and the tabstrip on the right). |
| 79 const int kOTRSideSpacing = 2; | 72 const int kOTRSideSpacing = 2; |
| 80 // The top 1 px of the tabstrip is shadow; in maximized mode we push this off | 73 // The top 1 px of the tabstrip is shadow; in maximized mode we push this off |
| 81 // the top of the screen so the tabs appear flush against the screen edge. | 74 // the top of the screen so the tabs appear flush against the screen edge. |
| 82 const int kTabstripTopShadowThickness = 1; | 75 const int kTabstripTopShadowThickness = 1; |
| 83 // In restored mode, the New Tab button isn't at the same height as the caption | 76 // In restored mode, the New Tab button isn't at the same height as the caption |
| 84 // buttons, but the space will look cluttered if it actually slides under them, | 77 // buttons, but the space will look cluttered if it actually slides under them, |
| 85 // so we stop it when the gap between the two is down to 5 px. | 78 // so we stop it when the gap between the two is down to 5 px. |
| 86 const int kNewTabCaptionRestoredSpacing = 5; | 79 const int kNewTabCaptionRestoredSpacing = 5; |
| 87 // In maximized mode, where the New Tab button and the caption buttons are at | 80 // In maximized mode, where the New Tab button and the caption buttons are at |
| 88 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid | 81 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid |
| 89 // looking too cluttered. | 82 // looking too cluttered. |
| 90 const int kNewTabCaptionMaximizedSpacing = 16; | 83 const int kNewTabCaptionMaximizedSpacing = 16; |
| 91 // How far to indent the tabstrip from the left side of the screen when there | 84 // How far to indent the tabstrip from the left side of the screen when there |
| 92 // is no OTR icon. | 85 // is no OTR icon. |
| 93 const int kTabStripIndent = 1; | 86 const int kTabStripIndent = 1; |
| 94 // Padding between the caption and start of vertical tabs. | |
| 95 const int kVerticalTabPadding = 6; | |
| 96 // Inset from the top of the toolbar/tabstrip to the shadow. Used only for | 87 // Inset from the top of the toolbar/tabstrip to the shadow. Used only for |
| 97 // vertical tabs. | 88 // vertical tabs. |
| 98 const int kVerticalTabBorderInset = 3; | 89 const int kVerticalTabBorderInset = 3; |
| 99 } | 90 } |
| 100 | 91 |
| 101 /////////////////////////////////////////////////////////////////////////////// | 92 /////////////////////////////////////////////////////////////////////////////// |
| 102 // OpaqueBrowserFrameView, public: | 93 // OpaqueBrowserFrameView, public: |
| 103 | 94 |
| 104 OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, | 95 OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, |
| 105 BrowserView* browser_view) | 96 BrowserView* browser_view) |
| 106 : BrowserNonClientFrameView(), | 97 : BrowserNonClientFrameView(), |
| 107 otr_avatar_icon_(new views::ImageView()), | |
| 108 ALLOW_THIS_IN_INITIALIZER_LIST( | 98 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 109 minimize_button_(new views::ImageButton(this))), | 99 minimize_button_(new views::ImageButton(this))), |
| 110 ALLOW_THIS_IN_INITIALIZER_LIST( | 100 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 111 maximize_button_(new views::ImageButton(this))), | 101 maximize_button_(new views::ImageButton(this))), |
| 112 ALLOW_THIS_IN_INITIALIZER_LIST( | 102 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 113 restore_button_(new views::ImageButton(this))), | 103 restore_button_(new views::ImageButton(this))), |
| 114 ALLOW_THIS_IN_INITIALIZER_LIST( | 104 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 115 close_button_(new views::ImageButton(this))), | 105 close_button_(new views::ImageButton(this))), |
| 116 window_icon_(NULL), | 106 window_icon_(NULL), |
| 117 frame_(frame), | 107 frame_(frame), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 tp->GetBitmapNamed(IDR_CLOSE_H)); | 157 tp->GetBitmapNamed(IDR_CLOSE_H)); |
| 168 close_button_->SetImage(views::CustomButton::BS_PUSHED, | 158 close_button_->SetImage(views::CustomButton::BS_PUSHED, |
| 169 tp->GetBitmapNamed(IDR_CLOSE_P)); | 159 tp->GetBitmapNamed(IDR_CLOSE_P)); |
| 170 if (browser_view_->IsBrowserTypeNormal()) { | 160 if (browser_view_->IsBrowserTypeNormal()) { |
| 171 close_button_->SetBackground(color, background, | 161 close_button_->SetBackground(color, background, |
| 172 tp->GetBitmapNamed(IDR_CLOSE_BUTTON_MASK)); | 162 tp->GetBitmapNamed(IDR_CLOSE_BUTTON_MASK)); |
| 173 } | 163 } |
| 174 close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE)); | 164 close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE)); |
| 175 AddChildView(close_button_); | 165 AddChildView(close_button_); |
| 176 | 166 |
| 177 otr_avatar_icon_->SetImage(browser_view_->GetOTRAvatarIcon()); | |
| 178 AddChildView(otr_avatar_icon_); | |
| 179 // Initializing the TabIconView is expensive, so only do it if we need to. | 167 // Initializing the TabIconView is expensive, so only do it if we need to. |
| 180 if (browser_view_->ShouldShowWindowIcon()) { | 168 if (browser_view_->ShouldShowWindowIcon()) { |
| 181 window_icon_ = new TabIconView(this); | 169 window_icon_ = new TabIconView(this); |
| 182 window_icon_->set_is_light(true); | 170 window_icon_->set_is_light(true); |
| 183 AddChildView(window_icon_); | 171 AddChildView(window_icon_); |
| 184 window_icon_->Update(); | 172 window_icon_->Update(); |
| 185 } | 173 } |
| 186 } | 174 } |
| 187 | 175 |
| 188 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() { | 176 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() { |
| 189 } | 177 } |
| 190 | 178 |
| 191 /////////////////////////////////////////////////////////////////////////////// | 179 /////////////////////////////////////////////////////////////////////////////// |
| 192 // OpaqueBrowserFrameView, BrowserNonClientFrameView implementation: | 180 // OpaqueBrowserFrameView, BrowserNonClientFrameView implementation: |
| 193 | 181 |
| 194 gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip( | 182 gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip( |
| 195 BaseTabStrip* tabstrip) const { | 183 BaseTabStrip* tabstrip) const { |
| 196 if (browser_view_->UseVerticalTabs()) { | 184 if (browser_view_->UseVerticalTabs()) { |
| 197 gfx::Size ps = tabstrip->GetPreferredSize(); | 185 gfx::Size ps = tabstrip->GetPreferredSize(); |
| 198 return gfx::Rect(NonClientBorderThickness(), NonClientTopBorderHeight(), | 186 return gfx::Rect(NonClientBorderThickness(), |
| 199 ps.width(), browser_view_->height()); | 187 NonClientTopBorderHeight(false, false), ps.width(), |
| 188 browser_view_->height()); |
| 200 } | 189 } |
| 201 | 190 |
| 202 int tabstrip_y = NonClientTopBorderHeight(); | |
| 203 if (!frame_->GetWindow()->IsMaximized() && | |
| 204 !frame_->GetWindow()->IsFullscreen()) | |
| 205 tabstrip_y += kNonClientRestoredExtraThickness; | |
| 206 | |
| 207 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? | 191 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? |
| 208 (otr_avatar_icon_->bounds().right() + kOTRSideSpacing) : | 192 (otr_avatar_bounds_.right() + kOTRSideSpacing) : |
| 209 NonClientBorderThickness() + kTabStripIndent; | 193 NonClientBorderThickness() + kTabStripIndent; |
| 210 | 194 |
| 211 int tabstrip_width = minimize_button_->x() - tabstrip_x - | 195 int tabstrip_width = minimize_button_->x() - tabstrip_x - |
| 212 (frame_->GetWindow()->IsMaximized() ? | 196 (frame_->GetWindow()->IsMaximized() ? |
| 213 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); | 197 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); |
| 214 return gfx::Rect(tabstrip_x, tabstrip_y, | 198 return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false), |
| 215 std::max(0, tabstrip_width), tabstrip->GetPreferredHeight()); | 199 std::max(0, tabstrip_width), tabstrip->GetPreferredHeight()); |
| 216 } | 200 } |
| 217 | 201 |
| 202 int OpaqueBrowserFrameView::GetHorizontalTabStripVerticalOffset( |
| 203 bool restored) const { |
| 204 return NonClientTopBorderHeight(restored, true) + ((!restored && |
| 205 (frame_->GetWindow()->IsMaximized() || |
| 206 frame_->GetWindow()->IsFullscreen())) ? |
| 207 0 : kNonClientRestoredExtraThickness); |
| 208 } |
| 209 |
| 218 void OpaqueBrowserFrameView::UpdateThrobber(bool running) { | 210 void OpaqueBrowserFrameView::UpdateThrobber(bool running) { |
| 219 if (window_icon_) | 211 if (window_icon_) |
| 220 window_icon_->Update(); | 212 window_icon_->Update(); |
| 221 } | 213 } |
| 222 | 214 |
| 223 gfx::Size OpaqueBrowserFrameView::GetMinimumSize() { | 215 gfx::Size OpaqueBrowserFrameView::GetMinimumSize() { |
| 224 gfx::Size min_size(browser_view_->GetMinimumSize()); | 216 gfx::Size min_size(browser_view_->GetMinimumSize()); |
| 225 int border_thickness = NonClientBorderThickness(); | 217 int border_thickness = NonClientBorderThickness(); |
| 226 min_size.Enlarge(2 * border_thickness, | 218 min_size.Enlarge(2 * border_thickness, |
| 227 NonClientTopBorderHeight() + border_thickness); | 219 NonClientTopBorderHeight(false, false) + border_thickness); |
| 228 | 220 |
| 229 views::WindowDelegate* d = frame_->GetWindow()->GetDelegate(); | 221 views::WindowDelegate* d = frame_->GetWindow()->GetDelegate(); |
| 230 int min_titlebar_width = (2 * FrameBorderThickness()) + kIconLeftSpacing + | 222 int min_titlebar_width = (2 * FrameBorderThickness(false)) + |
| 223 kIconLeftSpacing + |
| 231 (d->ShouldShowWindowIcon() ? (IconSize() + kTitleLogoSpacing) : 0); | 224 (d->ShouldShowWindowIcon() ? (IconSize() + kTitleLogoSpacing) : 0); |
| 232 #if !defined(OS_CHROMEOS) | 225 #if !defined(OS_CHROMEOS) |
| 233 min_titlebar_width += | 226 min_titlebar_width += |
| 234 minimize_button_->GetMinimumSize().width() + | 227 minimize_button_->GetMinimumSize().width() + |
| 235 restore_button_->GetMinimumSize().width() + | 228 restore_button_->GetMinimumSize().width() + |
| 236 close_button_->GetMinimumSize().width(); | 229 close_button_->GetMinimumSize().width(); |
| 237 #endif | 230 #endif |
| 238 min_size.set_width(std::max(min_size.width(), min_titlebar_width)); | 231 min_size.set_width(std::max(min_size.width(), min_titlebar_width)); |
| 239 return min_size; | 232 return min_size; |
| 240 } | 233 } |
| 241 | 234 |
| 242 /////////////////////////////////////////////////////////////////////////////// | 235 /////////////////////////////////////////////////////////////////////////////// |
| 243 // OpaqueBrowserFrameView, views::NonClientFrameView implementation: | 236 // OpaqueBrowserFrameView, views::NonClientFrameView implementation: |
| 244 | 237 |
| 245 gfx::Rect OpaqueBrowserFrameView::GetBoundsForClientView() const { | 238 gfx::Rect OpaqueBrowserFrameView::GetBoundsForClientView() const { |
| 246 return client_view_bounds_; | 239 return client_view_bounds_; |
| 247 } | 240 } |
| 248 | 241 |
| 249 bool OpaqueBrowserFrameView::AlwaysUseNativeFrame() const { | 242 bool OpaqueBrowserFrameView::AlwaysUseNativeFrame() const { |
| 250 return frame_->AlwaysUseNativeFrame(); | 243 return frame_->AlwaysUseNativeFrame(); |
| 251 } | 244 } |
| 252 | 245 |
| 253 bool OpaqueBrowserFrameView::AlwaysUseCustomFrame() const { | 246 bool OpaqueBrowserFrameView::AlwaysUseCustomFrame() const { |
| 254 return true; | 247 return true; |
| 255 } | 248 } |
| 256 | 249 |
| 257 gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds( | 250 gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds( |
| 258 const gfx::Rect& client_bounds) const { | 251 const gfx::Rect& client_bounds) const { |
| 259 int top_height = NonClientTopBorderHeight(); | 252 int top_height = NonClientTopBorderHeight(false, false); |
| 260 int border_thickness = NonClientBorderThickness(); | 253 int border_thickness = NonClientBorderThickness(); |
| 261 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), | 254 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), |
| 262 std::max(0, client_bounds.y() - top_height), | 255 std::max(0, client_bounds.y() - top_height), |
| 263 client_bounds.width() + (2 * border_thickness), | 256 client_bounds.width() + (2 * border_thickness), |
| 264 client_bounds.height() + top_height + border_thickness); | 257 client_bounds.height() + top_height + border_thickness); |
| 265 } | 258 } |
| 266 | 259 |
| 267 int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) { | 260 int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) { |
| 268 if (!bounds().Contains(point)) | 261 if (!bounds().Contains(point)) |
| 269 return HTNOWHERE; | 262 return HTNOWHERE; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 if (window->IsFullscreen()) | 331 if (window->IsFullscreen()) |
| 339 return; // Nothing is visible, so don't bother to paint. | 332 return; // Nothing is visible, so don't bother to paint. |
| 340 | 333 |
| 341 if (window->IsMaximized()) | 334 if (window->IsMaximized()) |
| 342 PaintMaximizedFrameBorder(canvas); | 335 PaintMaximizedFrameBorder(canvas); |
| 343 else | 336 else |
| 344 PaintRestoredFrameBorder(canvas); | 337 PaintRestoredFrameBorder(canvas); |
| 345 PaintTitleBar(canvas); | 338 PaintTitleBar(canvas); |
| 346 if (browser_view_->IsToolbarVisible()) | 339 if (browser_view_->IsToolbarVisible()) |
| 347 PaintToolbarBackground(canvas); | 340 PaintToolbarBackground(canvas); |
| 341 if (browser_view_->ShouldShowOffTheRecordAvatar()) |
| 342 PaintOTRAvatar(canvas); |
| 348 if (!window->IsMaximized()) | 343 if (!window->IsMaximized()) |
| 349 PaintRestoredClientEdge(canvas); | 344 PaintRestoredClientEdge(canvas); |
| 350 } | 345 } |
| 351 | 346 |
| 352 void OpaqueBrowserFrameView::PaintChildren(gfx::Canvas* canvas) { | |
| 353 if (!browser_view_->UseVerticalTabs() || !otr_avatar_icon_->IsVisible()) { | |
| 354 View::PaintChildren(canvas); | |
| 355 return; | |
| 356 } | |
| 357 | |
| 358 // The otr icon is clipped for side tabs. | |
| 359 for (int i = 0, count = GetChildViewCount(); i < count; ++i) { | |
| 360 View* child = GetChildViewAt(i); | |
| 361 if (!child) { | |
| 362 NOTREACHED() << "Should not have a NULL child View for index in bounds"; | |
| 363 continue; | |
| 364 } | |
| 365 if (child == otr_avatar_icon_) { | |
| 366 canvas->Save(); | |
| 367 canvas->ClipRectInt(0, 2, width(), otr_avatar_icon_->height() - 10); | |
| 368 child->ProcessPaint(canvas); | |
| 369 canvas->Restore(); | |
| 370 } else { | |
| 371 child->ProcessPaint(canvas); | |
| 372 } | |
| 373 } | |
| 374 } | |
| 375 | |
| 376 void OpaqueBrowserFrameView::Layout() { | 347 void OpaqueBrowserFrameView::Layout() { |
| 377 LayoutWindowControls(); | 348 LayoutWindowControls(); |
| 378 LayoutTitleBar(); | 349 LayoutTitleBar(); |
| 379 LayoutOTRAvatar(); | 350 LayoutOTRAvatar(); |
| 380 client_view_bounds_ = CalculateClientAreaBounds(width(), height()); | 351 client_view_bounds_ = CalculateClientAreaBounds(width(), height()); |
| 381 } | 352 } |
| 382 | 353 |
| 383 bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const { | 354 bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const { |
| 384 // If the point is outside the bounds of the client area, claim it. | 355 // If the point is outside the bounds of the client area, claim it. |
| 385 bool in_nonclient = NonClientFrameView::HitTest(l); | 356 bool in_nonclient = NonClientFrameView::HitTest(l); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 return current_tab ? current_tab->is_loading() : false; | 411 return current_tab ? current_tab->is_loading() : false; |
| 441 } | 412 } |
| 442 | 413 |
| 443 SkBitmap OpaqueBrowserFrameView::GetFavIconForTabIconView() { | 414 SkBitmap OpaqueBrowserFrameView::GetFavIconForTabIconView() { |
| 444 return frame_->GetWindow()->GetDelegate()->GetWindowIcon(); | 415 return frame_->GetWindow()->GetDelegate()->GetWindowIcon(); |
| 445 } | 416 } |
| 446 | 417 |
| 447 /////////////////////////////////////////////////////////////////////////////// | 418 /////////////////////////////////////////////////////////////////////////////// |
| 448 // OpaqueBrowserFrameView, private: | 419 // OpaqueBrowserFrameView, private: |
| 449 | 420 |
| 450 int OpaqueBrowserFrameView::FrameBorderThickness() const { | 421 int OpaqueBrowserFrameView::FrameBorderThickness(bool restored) const { |
| 451 views::Window* window = frame_->GetWindow(); | 422 views::Window* window = frame_->GetWindow(); |
| 452 return (window->IsMaximized() || window->IsFullscreen()) ? | 423 return (!restored && (window->IsMaximized() || window->IsFullscreen())) ? |
| 453 0 : kFrameBorderThickness; | 424 0 : kFrameBorderThickness; |
| 454 } | 425 } |
| 455 | 426 |
| 456 int OpaqueBrowserFrameView::TopResizeHeight() const { | 427 int OpaqueBrowserFrameView::TopResizeHeight() const { |
| 457 return FrameBorderThickness() - kTopResizeAdjust; | 428 return FrameBorderThickness(false) - kTopResizeAdjust; |
| 458 } | 429 } |
| 459 | 430 |
| 460 int OpaqueBrowserFrameView::NonClientBorderThickness() const { | 431 int OpaqueBrowserFrameView::NonClientBorderThickness() const { |
| 461 // When we fill the screen, we don't show a client edge. | 432 // When we fill the screen, we don't show a client edge. |
| 462 views::Window* window = frame_->GetWindow(); | 433 views::Window* window = frame_->GetWindow(); |
| 463 return FrameBorderThickness() + | 434 return FrameBorderThickness(false) + |
| 464 ((window->IsMaximized() || window->IsFullscreen()) ? | 435 ((window->IsMaximized() || window->IsFullscreen()) ? |
| 465 0 : kClientEdgeThickness); | 436 0 : kClientEdgeThickness); |
| 466 } | 437 } |
| 467 | 438 |
| 468 int OpaqueBrowserFrameView::NonClientTopBorderHeight() const { | 439 int OpaqueBrowserFrameView::NonClientTopBorderHeight( |
| 440 bool restored, |
| 441 bool ignore_vertical_tabs) const { |
| 469 views::Window* window = frame_->GetWindow(); | 442 views::Window* window = frame_->GetWindow(); |
| 470 if (window->GetDelegate()->ShouldShowWindowTitle()) { | 443 if (window->GetDelegate()->ShouldShowWindowTitle() || |
| 471 return std::max(FrameBorderThickness() + IconSize(), | 444 (browser_view_->IsTabStripVisible() && !ignore_vertical_tabs && |
| 472 CaptionButtonY() + kCaptionButtonHeightWithPadding) + | 445 browser_view_->UseVerticalTabs())) { |
| 473 TitlebarBottomThickness(); | 446 return std::max(FrameBorderThickness(restored) + IconSize(), |
| 447 CaptionButtonY(restored) + kCaptionButtonHeightWithPadding) + |
| 448 TitlebarBottomThickness(restored); |
| 474 } | 449 } |
| 475 | 450 |
| 476 if (browser_view_->IsTabStripVisible() && browser_view_->UseVerticalTabs()) { | 451 return FrameBorderThickness(restored) - |
| 477 return CaptionButtonY() + minimize_button_->GetPreferredSize().height() + | 452 ((browser_view_->IsTabStripVisible() && !restored && |
| 478 kVerticalTabPadding; | 453 window->IsMaximized()) ? kTabstripTopShadowThickness : 0); |
| 479 } | |
| 480 | |
| 481 return FrameBorderThickness() - | |
| 482 ((browser_view_->IsTabStripVisible() && window->IsMaximized()) ? | |
| 483 kTabstripTopShadowThickness : 0); | |
| 484 } | 454 } |
| 485 | 455 |
| 486 int OpaqueBrowserFrameView::CaptionButtonY() const { | 456 int OpaqueBrowserFrameView::CaptionButtonY(bool restored) const { |
| 487 // Maximized buttons start at window top so that even if their images aren't | 457 // Maximized buttons start at window top so that even if their images aren't |
| 488 // drawn flush with the screen edge, they still obey Fitts' Law. | 458 // drawn flush with the screen edge, they still obey Fitts' Law. |
| 489 return frame_->GetWindow()->IsMaximized() ? | 459 return (!restored && frame_->GetWindow()->IsMaximized()) ? |
| 490 FrameBorderThickness() : kFrameShadowThickness; | 460 FrameBorderThickness(false) : kFrameShadowThickness; |
| 491 } | 461 } |
| 492 | 462 |
| 493 int OpaqueBrowserFrameView::TitlebarBottomThickness() const { | 463 int OpaqueBrowserFrameView::TitlebarBottomThickness(bool restored) const { |
| 494 // When a toolbar is edging the titlebar, it draws its own bottom edge. | |
| 495 if (browser_view_->IsToolbarVisible()) | |
| 496 return 0; | |
| 497 | |
| 498 return kTitlebarTopAndBottomEdgeThickness + | 464 return kTitlebarTopAndBottomEdgeThickness + |
| 499 (frame_->GetWindow()->IsMaximized() ? 0 : kClientEdgeThickness); | 465 ((!restored && frame_->GetWindow()->IsMaximized()) ? |
| 466 0 : kClientEdgeThickness); |
| 500 } | 467 } |
| 501 | 468 |
| 502 int OpaqueBrowserFrameView::IconSize() const { | 469 int OpaqueBrowserFrameView::IconSize() const { |
| 503 #if defined(OS_WIN) | 470 #if defined(OS_WIN) |
| 504 // This metric scales up if either the titlebar height or the titlebar font | 471 // This metric scales up if either the titlebar height or the titlebar font |
| 505 // size are increased. | 472 // size are increased. |
| 506 return GetSystemMetrics(SM_CYSMICON); | 473 return GetSystemMetrics(SM_CYSMICON); |
| 507 #else | 474 #else |
| 508 return std::max(BrowserFrame::GetTitleFont().GetHeight(), kIconMinimumSize); | 475 return std::max(BrowserFrame::GetTitleFont().GetHeight(), kIconMinimumSize); |
| 509 #endif | 476 #endif |
| 510 } | 477 } |
| 511 | 478 |
| 512 gfx::Rect OpaqueBrowserFrameView::IconBounds() const { | 479 gfx::Rect OpaqueBrowserFrameView::IconBounds() const { |
| 513 int size = IconSize(); | 480 int size = IconSize(); |
| 514 int frame_thickness = FrameBorderThickness(); | 481 int frame_thickness = FrameBorderThickness(false); |
| 515 int y; | 482 int y; |
| 516 views::WindowDelegate* d = frame_->GetWindow()->GetDelegate(); | 483 views::WindowDelegate* d = frame_->GetWindow()->GetDelegate(); |
| 517 if (d->ShouldShowWindowIcon() || d->ShouldShowWindowTitle()) { | 484 if (d->ShouldShowWindowIcon() || d->ShouldShowWindowTitle()) { |
| 518 // Our frame border has a different "3D look" than Windows'. Theirs has a | 485 // Our frame border has a different "3D look" than Windows'. Theirs has a |
| 519 // more complex gradient on the top that they push their icon/title below; | 486 // more complex gradient on the top that they push their icon/title below; |
| 520 // then the maximized window cuts this off and the icon/title are centered | 487 // then the maximized window cuts this off and the icon/title are centered |
| 521 // in the remaining space. Because the apparent shape of our border is | 488 // in the remaining space. Because the apparent shape of our border is |
| 522 // simpler, using the same positioning makes things look slightly uncentered | 489 // simpler, using the same positioning makes things look slightly uncentered |
| 523 // with restored windows, so when the window is restored, instead of | 490 // with restored windows, so when the window is restored, instead of |
| 524 // calculating the remaining space from below the frame border, we calculate | 491 // calculating the remaining space from below the frame border, we calculate |
| 525 // from below the 3D edge. | 492 // from below the 3D edge. |
| 526 int unavailable_px_at_top = frame_->GetWindow()->IsMaximized() ? | 493 int unavailable_px_at_top = frame_->GetWindow()->IsMaximized() ? |
| 527 frame_thickness : kTitlebarTopAndBottomEdgeThickness; | 494 frame_thickness : kTitlebarTopAndBottomEdgeThickness; |
| 528 // When the icon is shorter than the minimum space we reserve for the | 495 // When the icon is shorter than the minimum space we reserve for the |
| 529 // caption button, we vertically center it. We want to bias rounding to put | 496 // caption button, we vertically center it. We want to bias rounding to put |
| 530 // extra space above the icon, since the 3D edge (+ client edge, for | 497 // extra space above the icon, since the 3D edge (+ client edge, for |
| 531 // restored windows) below looks (to the eye) more like additional space | 498 // restored windows) below looks (to the eye) more like additional space |
| 532 // than does the 3D edge (or nothing at all, for maximized windows) above; | 499 // than does the 3D edge (or nothing at all, for maximized windows) above; |
| 533 // hence the +1. | 500 // hence the +1. |
| 534 y = unavailable_px_at_top + (NonClientTopBorderHeight() - | 501 y = unavailable_px_at_top + (NonClientTopBorderHeight(false, false) - |
| 535 unavailable_px_at_top - size - TitlebarBottomThickness() + 1) / 2; | 502 unavailable_px_at_top - size - TitlebarBottomThickness(false) + 1) / 2; |
| 536 } else { | 503 } else { |
| 537 // For "browser mode" windows, we use the native positioning, which is just | 504 // For "browser mode" windows, we use the native positioning, which is just |
| 538 // below the top frame border. | 505 // below the top frame border. |
| 539 y = frame_thickness; | 506 y = frame_thickness; |
| 540 } | 507 } |
| 541 return gfx::Rect(frame_thickness + kIconLeftSpacing, y, size, size); | 508 return gfx::Rect(frame_thickness + kIconLeftSpacing, y, size, size); |
| 542 } | 509 } |
| 543 | 510 |
| 544 void OpaqueBrowserFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { | 511 void OpaqueBrowserFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { |
| 545 ThemeProvider* tp = GetThemeProvider(); | 512 ThemeProvider* tp = GetThemeProvider(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 height() - top_left_height - bottom_left_corner->height()); | 625 height() - top_left_height - bottom_left_corner->height()); |
| 659 } | 626 } |
| 660 | 627 |
| 661 | 628 |
| 662 void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { | 629 void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { |
| 663 ThemeProvider* tp = GetThemeProvider(); | 630 ThemeProvider* tp = GetThemeProvider(); |
| 664 views::Window* window = frame_->GetWindow(); | 631 views::Window* window = frame_->GetWindow(); |
| 665 | 632 |
| 666 // Window frame mode and color | 633 // Window frame mode and color |
| 667 SkBitmap* theme_frame; | 634 SkBitmap* theme_frame; |
| 668 int y = 0; | |
| 669 // Never theme app and popup windows. | 635 // Never theme app and popup windows. |
| 670 if (!browser_view_->IsBrowserTypeNormal()) { | 636 if (!browser_view_->IsBrowserTypeNormal()) { |
| 671 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 637 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 672 theme_frame = rb.GetBitmapNamed(ShouldPaintAsActive() ? | 638 theme_frame = rb.GetBitmapNamed(ShouldPaintAsActive() ? |
| 673 IDR_FRAME : IDR_FRAME_INACTIVE); | 639 IDR_FRAME : IDR_FRAME_INACTIVE); |
| 674 } else if (!browser_view_->IsOffTheRecord()) { | 640 } else if (!browser_view_->IsOffTheRecord()) { |
| 675 theme_frame = tp->GetBitmapNamed(ShouldPaintAsActive() ? | 641 theme_frame = tp->GetBitmapNamed(ShouldPaintAsActive() ? |
| 676 IDR_THEME_FRAME : IDR_THEME_FRAME_INACTIVE); | 642 IDR_THEME_FRAME : IDR_THEME_FRAME_INACTIVE); |
| 677 #if defined(OS_CHROMEOS) | |
| 678 // TODO:(oshima): gtk based CHROMEOS is using non custom frame | |
| 679 // mode which does this adjustment. This should be removed | |
| 680 // once it's fully migrated to views. -1 is due to the layout | |
| 681 // difference between views and gtk and will be removed. | |
| 682 // See http://crbug.com/28580. | |
| 683 y = -kCustomFrameBackgroundVerticalOffset - 1; | |
| 684 #endif | |
| 685 } else { | 643 } else { |
| 686 theme_frame = tp->GetBitmapNamed(ShouldPaintAsActive() ? | 644 theme_frame = tp->GetBitmapNamed(ShouldPaintAsActive() ? |
| 687 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME_INCOGNITO_INACTIVE); | 645 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME_INCOGNITO_INACTIVE); |
| 688 #if defined(OS_CHROMEOS) | |
| 689 y = -kCustomFrameBackgroundVerticalOffset - 1; | |
| 690 #endif | |
| 691 } | 646 } |
| 692 // Draw the theme frame. | 647 // Draw the theme frame. It must be aligned with the tabstrip as if we were |
| 693 canvas->TileImageInt(*theme_frame, 0, y, width(), theme_frame->height()); | 648 // in restored mode. Note that the top of the tabstrip is |
| 649 // kTabstripTopShadowThickness px off the top of the screen. |
| 650 int theme_background_y = -(GetHorizontalTabStripVerticalOffset(true) + |
| 651 kTabstripTopShadowThickness); |
| 652 canvas->TileImageInt(*theme_frame, 0, theme_background_y, width(), |
| 653 theme_frame->height()); |
| 694 | 654 |
| 695 // Draw the theme frame overlay | 655 // Draw the theme frame overlay |
| 696 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && | 656 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && |
| 697 browser_view_->IsBrowserTypeNormal()) { | 657 browser_view_->IsBrowserTypeNormal()) { |
| 698 SkBitmap* theme_overlay = tp->GetBitmapNamed(ShouldPaintAsActive() ? | 658 SkBitmap* theme_overlay = tp->GetBitmapNamed(ShouldPaintAsActive() ? |
| 699 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); | 659 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); |
| 700 canvas->DrawBitmapInt(*theme_overlay, 0, 0); | 660 canvas->DrawBitmapInt(*theme_overlay, 0, theme_background_y); |
| 701 } | 661 } |
| 702 | 662 |
| 703 if (!browser_view_->IsToolbarVisible()) { | 663 if (!browser_view_->IsToolbarVisible()) { |
| 704 // There's no toolbar to edge the frame border, so we need to draw a bottom | 664 // There's no toolbar to edge the frame border, so we need to draw a bottom |
| 705 // edge. The graphic we use for this has a built in client edge, so we clip | 665 // edge. The graphic we use for this has a built in client edge, so we clip |
| 706 // it off the bottom. | 666 // it off the bottom. |
| 707 SkBitmap* top_center = | 667 SkBitmap* top_center = |
| 708 tp->GetBitmapNamed(IDR_APP_TOP_CENTER); | 668 tp->GetBitmapNamed(IDR_APP_TOP_CENTER); |
| 709 int edge_height = top_center->height() - kClientEdgeThickness; | 669 int edge_height = top_center->height() - kClientEdgeThickness; |
| 710 canvas->TileImageInt(*top_center, 0, | 670 canvas->TileImageInt(*top_center, 0, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 722 /* TODO(pkasting): If this window is active, we should also draw a drop | 682 /* TODO(pkasting): If this window is active, we should also draw a drop |
| 723 * shadow on the title. This is tricky, because we don't want to hardcode a | 683 * shadow on the title. This is tricky, because we don't want to hardcode a |
| 724 * shadow color (since we want to work with various themes), but we can't | 684 * shadow color (since we want to work with various themes), but we can't |
| 725 * alpha-blend either (since the Windows text APIs don't really do this). | 685 * alpha-blend either (since the Windows text APIs don't really do this). |
| 726 * So we'd need to sample the background color at the right location and | 686 * So we'd need to sample the background color at the right location and |
| 727 * synthesize a good shadow color. */ | 687 * synthesize a good shadow color. */ |
| 728 } | 688 } |
| 729 } | 689 } |
| 730 | 690 |
| 731 void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { | 691 void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { |
| 732 gfx::Rect toolbar_bounds = GetViewBounds(browser_view_->toolbar(), this); | 692 gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds()); |
| 733 if (toolbar_bounds.IsEmpty()) | 693 if (toolbar_bounds.IsEmpty()) |
| 734 return; | 694 return; |
| 695 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
| 696 ConvertPointToView(browser_view_, this, &toolbar_origin); |
| 697 toolbar_bounds.set_origin(toolbar_origin); |
| 735 | 698 |
| 736 int x, y, w, h; | 699 int x = toolbar_bounds.x(); |
| 700 int w = toolbar_bounds.width(); |
| 701 int y, h; |
| 737 if (browser_view_->UseVerticalTabs()) { | 702 if (browser_view_->UseVerticalTabs()) { |
| 738 gfx::Rect tabstrip_bounds = GetViewBounds(browser_view_->tabstrip(), this); | 703 gfx::Point tabstrip_origin(browser_view_->tabstrip()->bounds().origin()); |
| 739 x = tabstrip_bounds.x(); | 704 ConvertPointToView(browser_view_, this, &tabstrip_origin); |
| 740 w = toolbar_bounds.right() - x; | 705 y = tabstrip_origin.y() - kVerticalTabBorderInset; |
| 741 y = tabstrip_bounds.y() - kVerticalTabBorderInset; | |
| 742 h = toolbar_bounds.bottom() - y; | 706 h = toolbar_bounds.bottom() - y; |
| 743 } else { | 707 } else { |
| 744 x = toolbar_bounds.x(); | |
| 745 w = toolbar_bounds.width(); | |
| 746 y = toolbar_bounds.y(); | 708 y = toolbar_bounds.y(); |
| 747 h = toolbar_bounds.bottom(); | 709 h = toolbar_bounds.bottom(); |
| 748 } | 710 } |
| 749 | 711 |
| 750 // Gross hack: We split the toolbar images into two pieces, since sometimes | 712 // Gross hack: We split the toolbar images into two pieces, since sometimes |
| 751 // (popup mode) the toolbar isn't tall enough to show the whole image. The | 713 // (popup mode) the toolbar isn't tall enough to show the whole image. The |
| 752 // split happens between the top shadow section and the bottom gradient | 714 // split happens between the top shadow section and the bottom gradient |
| 753 // section so that we never break the gradient. | 715 // section so that we never break the gradient. |
| 754 int split_point = kFrameShadowThickness * 2; | 716 int split_point = kFrameShadowThickness * 2; |
| 755 int bottom_y = y + split_point; | 717 int bottom_y = y + split_point; |
| 756 ThemeProvider* tp = GetThemeProvider(); | 718 ThemeProvider* tp = GetThemeProvider(); |
| 757 SkBitmap* toolbar_left = tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER); | 719 SkBitmap* toolbar_left = tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER); |
| 758 int bottom_edge_height = std::min(toolbar_left->height(), h) - split_point; | 720 int bottom_edge_height = std::min(toolbar_left->height(), h) - split_point; |
| 759 | 721 |
| 760 // Split our canvas out so we can mask out the corners of the toolbar | 722 // Split our canvas out so we can mask out the corners of the toolbar |
| 761 // without masking out the frame. | 723 // without masking out the frame. |
| 762 canvas->SaveLayerAlpha( | 724 canvas->SaveLayerAlpha( |
| 763 255, gfx::Rect(x - kClientEdgeThickness, y, w + kClientEdgeThickness * 3, | 725 255, gfx::Rect(x - kClientEdgeThickness, y, w + kClientEdgeThickness * 3, |
| 764 h)); | 726 h)); |
| 765 canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); | 727 canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); |
| 766 | 728 |
| 767 SkColor theme_toolbar_color = | 729 SkColor theme_toolbar_color = |
| 768 tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR); | 730 tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR); |
| 769 canvas->FillRectInt(theme_toolbar_color, x, bottom_y, w, bottom_edge_height); | 731 canvas->FillRectInt(theme_toolbar_color, x, bottom_y, w, bottom_edge_height); |
| 770 | 732 |
| 733 // Tile the toolbar image starting at the frame edge on the left and where the |
| 734 // horizontal tabstrip is (or would be) on the top. |
| 771 SkBitmap* theme_toolbar = tp->GetBitmapNamed(IDR_THEME_TOOLBAR); | 735 SkBitmap* theme_toolbar = tp->GetBitmapNamed(IDR_THEME_TOOLBAR); |
| 772 int strip_height = browser_view_->GetTabStripHeight(); | 736 canvas->TileImageInt(*theme_toolbar, x, |
| 773 canvas->TileImageInt(*theme_toolbar, x - kClientEdgeThickness, | 737 bottom_y - GetHorizontalTabStripVerticalOffset(false), x, |
| 774 strip_height - kFrameShadowThickness, x - kClientEdgeThickness, bottom_y, | 738 bottom_y, w, theme_toolbar->height()); |
| 775 w + (2 * kClientEdgeThickness), theme_toolbar->height()); | |
| 776 | 739 |
| 777 // Draw rounded corners for the tab. | 740 // Draw rounded corners for the tab. |
| 778 SkBitmap* toolbar_left_mask = | 741 SkBitmap* toolbar_left_mask = |
| 779 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK); | 742 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK); |
| 780 SkBitmap* toolbar_right_mask = | 743 SkBitmap* toolbar_right_mask = |
| 781 tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK); | 744 tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK); |
| 782 | 745 |
| 783 // We mask out the corners by using the DestinationIn transfer mode, | 746 // We mask out the corners by using the DestinationIn transfer mode, |
| 784 // which keeps the RGB pixels from the destination and the alpha from | 747 // which keeps the RGB pixels from the destination and the alpha from |
| 785 // the source. | 748 // the source. |
| 786 SkPaint paint; | 749 SkPaint paint; |
| 787 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); | 750 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); |
| 788 | 751 |
| 789 // Mask the left edge. | 752 // Mask the left edge. |
| 790 int left_x = x - kContentEdgeShadowThickness; | 753 int left_x = x - kContentEdgeShadowThickness; |
| 791 canvas->DrawBitmapInt(*toolbar_left_mask, 0, 0, toolbar_left_mask->width(), | 754 canvas->DrawBitmapInt(*toolbar_left_mask, 0, 0, toolbar_left_mask->width(), |
| 792 split_point, left_x, y, toolbar_left_mask->width(), | 755 split_point, left_x, y, toolbar_left_mask->width(), |
| 793 split_point, false, paint); | 756 split_point, false, paint); |
| 794 canvas->DrawBitmapInt(*toolbar_left_mask, 0, | 757 canvas->DrawBitmapInt(*toolbar_left_mask, 0, |
| 795 toolbar_left_mask->height() - bottom_edge_height, | 758 toolbar_left_mask->height() - bottom_edge_height, |
| 796 toolbar_left_mask->width(), bottom_edge_height, left_x, bottom_y, | 759 toolbar_left_mask->width(), bottom_edge_height, left_x, bottom_y, |
| 797 toolbar_left_mask->width(), bottom_edge_height, false, paint); | 760 toolbar_left_mask->width(), bottom_edge_height, false, paint); |
| 798 | 761 |
| 799 // Mask the right edge. | 762 // Mask the right edge. |
| 800 int right_x = x + w - toolbar_right_mask->width() + kClientEdgeThickness + | 763 int right_x = |
| 801 kContentEdgeShadowThickness; | 764 x + w - toolbar_right_mask->width() + kContentEdgeShadowThickness; |
| 802 canvas->DrawBitmapInt(*toolbar_right_mask, 0, 0, toolbar_right_mask->width(), | 765 canvas->DrawBitmapInt(*toolbar_right_mask, 0, 0, toolbar_right_mask->width(), |
| 803 split_point, right_x, y, toolbar_right_mask->width(), | 766 split_point, right_x, y, toolbar_right_mask->width(), |
| 804 split_point, false, paint); | 767 split_point, false, paint); |
| 805 canvas->DrawBitmapInt(*toolbar_right_mask, 0, | 768 canvas->DrawBitmapInt(*toolbar_right_mask, 0, |
| 806 toolbar_right_mask->height() - bottom_edge_height, | 769 toolbar_right_mask->height() - bottom_edge_height, |
| 807 toolbar_right_mask->width(), bottom_edge_height, right_x, bottom_y, | 770 toolbar_right_mask->width(), bottom_edge_height, right_x, bottom_y, |
| 808 toolbar_right_mask->width(), bottom_edge_height, false, paint); | 771 toolbar_right_mask->width(), bottom_edge_height, false, paint); |
| 809 canvas->Restore(); | 772 canvas->Restore(); |
| 810 | 773 |
| 811 canvas->DrawBitmapInt(*toolbar_left, 0, 0, toolbar_left->width(), split_point, | 774 canvas->DrawBitmapInt(*toolbar_left, 0, 0, toolbar_left->width(), split_point, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 824 SkBitmap* toolbar_right = tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER); | 787 SkBitmap* toolbar_right = tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER); |
| 825 canvas->DrawBitmapInt(*toolbar_right, 0, 0, toolbar_right->width(), | 788 canvas->DrawBitmapInt(*toolbar_right, 0, 0, toolbar_right->width(), |
| 826 split_point, right_x, y, toolbar_right->width(), split_point, false); | 789 split_point, right_x, y, toolbar_right->width(), split_point, false); |
| 827 canvas->DrawBitmapInt(*toolbar_right, 0, | 790 canvas->DrawBitmapInt(*toolbar_right, 0, |
| 828 toolbar_right->height() - bottom_edge_height, toolbar_right->width(), | 791 toolbar_right->height() - bottom_edge_height, toolbar_right->width(), |
| 829 bottom_edge_height, right_x, bottom_y, toolbar_right->width(), | 792 bottom_edge_height, right_x, bottom_y, toolbar_right->width(), |
| 830 bottom_edge_height, false); | 793 bottom_edge_height, false); |
| 831 | 794 |
| 832 // Draw the content/toolbar separator. | 795 // Draw the content/toolbar separator. |
| 833 canvas->FillRectInt(ResourceBundle::toolbar_separator_color, | 796 canvas->FillRectInt(ResourceBundle::toolbar_separator_color, |
| 834 toolbar_bounds.x(), toolbar_bounds.bottom() - kClientEdgeThickness, | 797 x + kClientEdgeThickness, toolbar_bounds.bottom() - kClientEdgeThickness, |
| 835 toolbar_bounds.width(), kClientEdgeThickness); | 798 w - (2 * kClientEdgeThickness), kClientEdgeThickness); |
| 799 } |
| 800 |
| 801 void OpaqueBrowserFrameView::PaintOTRAvatar(gfx::Canvas* canvas) { |
| 802 // In RTL mode, the avatar icon should be looking the opposite direction. |
| 803 canvas->Save(); |
| 804 if (base::i18n::IsRTL()) { |
| 805 canvas->TranslateInt(width(), 0); |
| 806 canvas->ScaleInt(-1, 1); |
| 807 } |
| 808 |
| 809 SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon(); |
| 810 int w = otr_avatar_bounds_.width(); |
| 811 int h = otr_avatar_bounds_.height(); |
| 812 canvas->DrawBitmapInt(otr_avatar_icon, 0, |
| 813 // Bias the rounding to select a region that's lower rather than higher, |
| 814 // as the shadows at the image top mean the apparent center is below the |
| 815 // real center. |
| 816 ((otr_avatar_icon.height() - otr_avatar_bounds_.height()) + 1) / 2, w, h, |
| 817 otr_avatar_bounds_.x(), otr_avatar_bounds_.y(), w, h, false); |
| 818 |
| 819 canvas->Restore(); |
| 836 } | 820 } |
| 837 | 821 |
| 838 void OpaqueBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { | 822 void OpaqueBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { |
| 839 ThemeProvider* tp = GetThemeProvider(); | 823 ThemeProvider* tp = GetThemeProvider(); |
| 840 int client_area_top = frame_->GetWindow()->GetClientView()->y(); | 824 int client_area_top = frame_->GetWindow()->GetClientView()->y(); |
| 825 int image_top = client_area_top; |
| 841 | 826 |
| 842 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); | 827 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); |
| 843 SkColor toolbar_color = tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR); | 828 SkColor toolbar_color = tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR); |
| 844 | 829 |
| 845 if (browser_view_->IsToolbarVisible()) { | 830 if (browser_view_->IsToolbarVisible()) { |
| 846 // The client edges start below the toolbar or its corner images, whichever | 831 // The client edge images always start below the toolbar corner images. The |
| 847 // is shorter. | 832 // client edge filled rects start there or at the bottom of the tooolbar, |
| 833 // whichever is shorter. |
| 848 gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds()); | 834 gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds()); |
| 849 client_area_top += browser_view_->GetToolbarBounds().y() + | 835 image_top += toolbar_bounds.y() + |
| 850 std::min(tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height(), | 836 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height(); |
| 851 toolbar_bounds.height()); | 837 client_area_top = std::min(image_top, |
| 852 if (browser_view_->UseVerticalTabs()) | 838 client_area_top + toolbar_bounds.bottom() - kClientEdgeThickness); |
| 839 if (browser_view_->UseVerticalTabs()) { |
| 853 client_area_top -= kVerticalTabBorderInset; | 840 client_area_top -= kVerticalTabBorderInset; |
| 841 image_top -= kVerticalTabBorderInset; |
| 842 } |
| 854 } else if (!browser_view_->IsTabStripVisible()) { | 843 } else if (!browser_view_->IsTabStripVisible()) { |
| 855 // The toolbar isn't going to draw a client edge for us, so draw one | 844 // The toolbar isn't going to draw a client edge for us, so draw one |
| 856 // ourselves. | 845 // ourselves. |
| 857 SkBitmap* top_left = tp->GetBitmapNamed(IDR_APP_TOP_LEFT); | 846 SkBitmap* top_left = tp->GetBitmapNamed(IDR_APP_TOP_LEFT); |
| 858 SkBitmap* top_center = tp->GetBitmapNamed(IDR_APP_TOP_CENTER); | 847 SkBitmap* top_center = tp->GetBitmapNamed(IDR_APP_TOP_CENTER); |
| 859 SkBitmap* top_right = tp->GetBitmapNamed(IDR_APP_TOP_RIGHT); | 848 SkBitmap* top_right = tp->GetBitmapNamed(IDR_APP_TOP_RIGHT); |
| 860 int top_edge_y = client_area_top - top_center->height(); | 849 int top_edge_y = client_area_top - top_center->height(); |
| 861 int height = client_area_top - top_edge_y; | 850 int height = client_area_top - top_edge_y; |
| 862 | 851 |
| 863 canvas->DrawBitmapInt(*top_left, 0, 0, top_left->width(), height, | 852 canvas->DrawBitmapInt(*top_left, 0, 0, top_left->width(), height, |
| 864 client_area_bounds.x() - top_left->width(), top_edge_y, | 853 client_area_bounds.x() - top_left->width(), top_edge_y, |
| 865 top_left->width(), height, false); | 854 top_left->width(), height, false); |
| 866 canvas->TileImageInt(*top_center, 0, 0, client_area_bounds.x(), top_edge_y, | 855 canvas->TileImageInt(*top_center, 0, 0, client_area_bounds.x(), top_edge_y, |
| 867 client_area_bounds.width(), std::min(height, top_center->height())); | 856 client_area_bounds.width(), std::min(height, top_center->height())); |
| 868 canvas->DrawBitmapInt(*top_right, 0, 0, top_right->width(), height, | 857 canvas->DrawBitmapInt(*top_right, 0, 0, top_right->width(), height, |
| 869 client_area_bounds.right(), top_edge_y, | 858 client_area_bounds.right(), top_edge_y, |
| 870 top_right->width(), height, false); | 859 top_right->width(), height, false); |
| 871 | 860 |
| 872 // Draw the toolbar color across the top edge. | 861 // Draw the toolbar color across the top edge. |
| 873 canvas->FillRectInt(toolbar_color, | 862 canvas->FillRectInt(toolbar_color, |
| 874 client_area_bounds.x() - kClientEdgeThickness, | 863 client_area_bounds.x() - kClientEdgeThickness, |
| 875 client_area_top - kClientEdgeThickness, | 864 client_area_top - kClientEdgeThickness, |
| 876 client_area_bounds.width() + (2 * kClientEdgeThickness), | 865 client_area_bounds.width() + (2 * kClientEdgeThickness), |
| 877 kClientEdgeThickness); | 866 kClientEdgeThickness); |
| 878 } | 867 } |
| 879 | 868 |
| 880 int client_area_bottom = | 869 int client_area_bottom = |
| 881 std::max(client_area_top, height() - NonClientBorderThickness()); | 870 std::max(client_area_top, height() - NonClientBorderThickness()); |
| 882 int client_area_height = client_area_bottom - client_area_top; | 871 int image_height = client_area_bottom - image_top; |
| 883 | |
| 884 // Draw the toolbar color so that the client edges show the right color even | |
| 885 // where not covered by the toolbar image. | |
| 886 canvas->FillRectInt(toolbar_color, | |
| 887 client_area_bounds.x() - kClientEdgeThickness, client_area_top, | |
| 888 kClientEdgeThickness, | |
| 889 client_area_bottom + kClientEdgeThickness - client_area_top); | |
| 890 canvas->FillRectInt(toolbar_color, client_area_bounds.x(), client_area_bottom, | |
| 891 client_area_bounds.width(), kClientEdgeThickness); | |
| 892 canvas->FillRectInt(toolbar_color, client_area_bounds.right(), | |
| 893 client_area_top, kClientEdgeThickness, | |
| 894 client_area_bottom + kClientEdgeThickness - client_area_top); | |
| 895 | 872 |
| 896 // Draw the client edge images. | 873 // Draw the client edge images. |
| 874 // Draw the client edge images. |
| 897 SkBitmap* right = tp->GetBitmapNamed(IDR_CONTENT_RIGHT_SIDE); | 875 SkBitmap* right = tp->GetBitmapNamed(IDR_CONTENT_RIGHT_SIDE); |
| 898 canvas->TileImageInt(*right, client_area_bounds.right(), client_area_top, | 876 canvas->TileImageInt(*right, client_area_bounds.right(), image_top, |
| 899 right->width(), client_area_height); | 877 right->width(), image_height); |
| 900 canvas->DrawBitmapInt( | 878 canvas->DrawBitmapInt( |
| 901 *tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), | 879 *tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), |
| 902 client_area_bounds.right(), client_area_bottom); | 880 client_area_bounds.right(), client_area_bottom); |
| 903 SkBitmap* bottom = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_CENTER); | 881 SkBitmap* bottom = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_CENTER); |
| 904 canvas->TileImageInt(*bottom, client_area_bounds.x(), | 882 canvas->TileImageInt(*bottom, client_area_bounds.x(), |
| 905 client_area_bottom, client_area_bounds.width(), | 883 client_area_bottom, client_area_bounds.width(), |
| 906 bottom->height()); | 884 bottom->height()); |
| 907 SkBitmap* bottom_left = | 885 SkBitmap* bottom_left = |
| 908 tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER); | 886 tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER); |
| 909 canvas->DrawBitmapInt(*bottom_left, | 887 canvas->DrawBitmapInt(*bottom_left, |
| 910 client_area_bounds.x() - bottom_left->width(), client_area_bottom); | 888 client_area_bounds.x() - bottom_left->width(), client_area_bottom); |
| 911 SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); | 889 SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); |
| 912 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), | 890 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), |
| 913 client_area_top, left->width(), client_area_height); | 891 image_top, left->width(), image_height); |
| 892 |
| 893 // Draw the toolbar color so that the client edges show the right color even |
| 894 // where not covered by the toolbar image. NOTE: We do this after drawing the |
| 895 // images because the images are meant to alpha-blend atop the frame whereas |
| 896 // these rects are meant to be fully opaque, without anything overlaid. |
| 897 canvas->FillRectInt(toolbar_color, |
| 898 client_area_bounds.x() - kClientEdgeThickness, client_area_top, |
| 899 kClientEdgeThickness, |
| 900 client_area_bottom + kClientEdgeThickness - client_area_top); |
| 901 canvas->FillRectInt(toolbar_color, client_area_bounds.x(), client_area_bottom, |
| 902 client_area_bounds.width(), kClientEdgeThickness); |
| 903 canvas->FillRectInt(toolbar_color, client_area_bounds.right(), |
| 904 client_area_top, kClientEdgeThickness, |
| 905 client_area_bottom + kClientEdgeThickness - client_area_top); |
| 914 } | 906 } |
| 915 | 907 |
| 916 void OpaqueBrowserFrameView::LayoutWindowControls() { | 908 void OpaqueBrowserFrameView::LayoutWindowControls() { |
| 917 bool is_maximized = frame_->GetWindow()->IsMaximized(); | 909 bool is_maximized = frame_->GetWindow()->IsMaximized(); |
| 918 close_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT, | 910 close_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT, |
| 919 views::ImageButton::ALIGN_BOTTOM); | 911 views::ImageButton::ALIGN_BOTTOM); |
| 920 int caption_y = CaptionButtonY(); | 912 int caption_y = CaptionButtonY(false); |
| 921 // There should always be the same number of non-shadow pixels visible to the | 913 // There should always be the same number of non-shadow pixels visible to the |
| 922 // side of the caption buttons. In maximized mode we extend the rightmost | 914 // side of the caption buttons. In maximized mode we extend the rightmost |
| 923 // button to the screen corner to obey Fitts' Law. | 915 // button to the screen corner to obey Fitts' Law. |
| 924 int right_extra_width = is_maximized ? | 916 int right_extra_width = is_maximized ? |
| 925 (kFrameBorderThickness - kFrameShadowThickness) : 0; | 917 (kFrameBorderThickness - kFrameShadowThickness) : 0; |
| 926 gfx::Size close_button_size = close_button_->GetPreferredSize(); | 918 gfx::Size close_button_size = close_button_->GetPreferredSize(); |
| 927 close_button_->SetBounds(width() - FrameBorderThickness() - | 919 close_button_->SetBounds(width() - FrameBorderThickness(false) - |
| 928 right_extra_width - close_button_size.width(), caption_y, | 920 right_extra_width - close_button_size.width(), caption_y, |
| 929 close_button_size.width() + right_extra_width, | 921 close_button_size.width() + right_extra_width, |
| 930 close_button_size.height()); | 922 close_button_size.height()); |
| 931 | 923 |
| 932 #if defined(OS_CHROMEOS) | 924 #if defined(OS_CHROMEOS) |
| 933 if (is_maximized) { | 925 if (is_maximized) { |
| 934 minimize_button_->SetVisible(false); | 926 minimize_button_->SetVisible(false); |
| 935 restore_button_->SetVisible(false); | 927 restore_button_->SetVisible(false); |
| 936 maximize_button_->SetVisible(false); | 928 maximize_button_->SetVisible(false); |
| 937 | 929 |
| 938 if (browser_view_->browser()->type() == Browser::TYPE_DEVTOOLS) { | 930 if (browser_view_->browser()->type() == Browser::TYPE_DEVTOOLS) { |
| 939 close_button_->SetVisible(true); | 931 close_button_->SetVisible(true); |
| 940 minimize_button_->SetBounds(close_button_->bounds().x(), 0, 0, 0); | 932 minimize_button_->SetBounds(close_button_->bounds().x(), 0, 0, 0); |
| 941 } else { | 933 } else { |
| 942 close_button_->SetVisible(false); | 934 close_button_->SetVisible(false); |
| 943 // Set the bounds of the minimize button so that we don't have to change | 935 // Set the bounds of the minimize button so that we don't have to change |
| 944 // other places that rely on the bounds. Put it slightly to the right | 936 // other places that rely on the bounds. Put it slightly to the right |
| 945 // of the edge of the view, so that when we remove the spacing it lines | 937 // of the edge of the view, so that when we remove the spacing it lines |
| 946 // up with the edge. | 938 // up with the edge. |
| 947 minimize_button_->SetBounds( | 939 minimize_button_->SetBounds(width() - FrameBorderThickness(false) + |
| 948 width() - FrameBorderThickness() + kNewTabCaptionMaximizedSpacing, | 940 kNewTabCaptionMaximizedSpacing, 0, 0, 0); |
| 949 0, 0, 0); | |
| 950 } | 941 } |
| 951 | 942 |
| 952 return; | 943 return; |
| 953 } else { | 944 } else { |
| 954 close_button_->SetVisible(true); | 945 close_button_->SetVisible(true); |
| 955 } | 946 } |
| 956 #endif | 947 #endif |
| 957 | 948 |
| 958 // When the window is restored, we show a maximized button; otherwise, we show | 949 // When the window is restored, we show a maximized button; otherwise, we show |
| 959 // a restore button. | 950 // a restore button. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 // already biased downwards (see IconBounds()) and helps prevent descenders | 992 // already biased downwards (see IconBounds()) and helps prevent descenders |
| 1002 // on the title from overlapping the 3D edge at the bottom of the titlebar. | 993 // on the title from overlapping the 3D edge at the bottom of the titlebar. |
| 1003 title_bounds_.SetRect(title_x, | 994 title_bounds_.SetRect(title_x, |
| 1004 icon_bounds.y() + ((icon_bounds.height() - title_height - 1) / 2), | 995 icon_bounds.y() + ((icon_bounds.height() - title_height - 1) / 2), |
| 1005 std::max(0, minimize_button_->x() - kTitleLogoSpacing - title_x), | 996 std::max(0, minimize_button_->x() - kTitleLogoSpacing - title_x), |
| 1006 title_height); | 997 title_height); |
| 1007 } | 998 } |
| 1008 } | 999 } |
| 1009 | 1000 |
| 1010 void OpaqueBrowserFrameView::LayoutOTRAvatar() { | 1001 void OpaqueBrowserFrameView::LayoutOTRAvatar() { |
| 1011 int otr_y = NonClientTopBorderHeight(); | 1002 SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon(); |
| 1012 if (!frame_->GetWindow()->IsMaximized() && | 1003 int otr_bottom, otr_restored_y; |
| 1013 !frame_->GetWindow()->IsFullscreen()) { | 1004 if (browser_view_->UseVerticalTabs()) { |
| 1014 otr_y += kNonClientRestoredExtraThickness; | 1005 otr_bottom = NonClientTopBorderHeight(false, false) - kOTRBottomSpacing; |
| 1006 otr_restored_y = kFrameShadowThickness; |
| 1007 } else { |
| 1008 otr_bottom = GetHorizontalTabStripVerticalOffset(false) + |
| 1009 browser_view_->GetTabStripHeight() - kOTRBottomSpacing; |
| 1010 otr_restored_y = otr_bottom - otr_avatar_icon.height(); |
| 1015 } | 1011 } |
| 1016 bool visible = browser_view_->ShouldShowOffTheRecordAvatar(); | 1012 int otr_y = frame_->GetWindow()->IsMaximized() ? |
| 1017 gfx::Size preferred_size = otr_avatar_icon_->GetPreferredSize(); | 1013 (NonClientTopBorderHeight(false, true) + kTabstripTopShadowThickness) : |
| 1018 int otr_height = 0; | 1014 otr_restored_y; |
| 1019 if (browser_view_->IsTabStripVisible()) { | 1015 otr_avatar_bounds_.SetRect(NonClientBorderThickness() + kOTRSideSpacing, |
| 1020 if (browser_view_->UseVerticalTabs()) { | 1016 otr_y, otr_avatar_icon.width(), otr_bottom - otr_y); |
| 1021 otr_height = preferred_size.height(); | |
| 1022 otr_y = -2; | |
| 1023 } else { | |
| 1024 int tabstrip_height = | |
| 1025 browser_view_->GetTabStripHeight() - kOTRBottomSpacing; | |
| 1026 otr_height = frame_->GetWindow()->IsMaximized() ? | |
| 1027 (tabstrip_height - kOTRMaximizedTopSpacing) : | |
| 1028 preferred_size.height(); | |
| 1029 otr_y += tabstrip_height - otr_height; | |
| 1030 } | |
| 1031 } else { | |
| 1032 visible = false; | |
| 1033 } | |
| 1034 otr_avatar_icon_->SetVisible(visible); | |
| 1035 otr_avatar_icon_->SetBounds(NonClientBorderThickness() + kOTRSideSpacing, | |
| 1036 otr_y, preferred_size.width(), otr_height); | |
| 1037 } | 1017 } |
| 1038 | 1018 |
| 1039 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, | 1019 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, |
| 1040 int height) const { | 1020 int height) const { |
| 1041 int top_height = NonClientTopBorderHeight(); | 1021 int top_height = NonClientTopBorderHeight(false, false); |
| 1042 int border_thickness = NonClientBorderThickness(); | 1022 int border_thickness = NonClientBorderThickness(); |
| 1043 return gfx::Rect(border_thickness, top_height, | 1023 return gfx::Rect(border_thickness, top_height, |
| 1044 std::max(0, width - (2 * border_thickness)), | 1024 std::max(0, width - (2 * border_thickness)), |
| 1045 std::max(0, height - top_height - border_thickness)); | 1025 std::max(0, height - top_height - border_thickness)); |
| 1046 } | 1026 } |
| 1047 | |
| 1048 // static | |
| 1049 gfx::Rect OpaqueBrowserFrameView::GetViewBounds(views::View* src, | |
| 1050 views::View* dst) { | |
| 1051 gfx::Rect bounds(src->bounds()); | |
| 1052 | |
| 1053 gfx::Point origin_in_dst(bounds.origin()); | |
| 1054 View::ConvertPointToView(src->GetParent(), dst, &origin_in_dst); | |
| 1055 bounds.set_origin(origin_in_dst); | |
| 1056 return bounds; | |
| 1057 } | |
| OLD | NEW |