OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/frame/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 namespace { | 42 namespace { |
43 // Size of client edge drawn inside the outer frame borders. | 43 // Size of client edge drawn inside the outer frame borders. |
44 const int kNonClientBorderThicknessPreWin10 = 3; | 44 const int kNonClientBorderThicknessPreWin10 = 3; |
45 const int kNonClientBorderThicknessWin10 = 1; | 45 const int kNonClientBorderThicknessWin10 = 1; |
46 // Besides the frame border, there's another 9 px of empty space atop the | 46 // Besides the frame border, there's another 9 px of empty space atop the |
47 // window in restored mode, to use to drag the window around. | 47 // window in restored mode, to use to drag the window around. |
48 const int kNonClientRestoredExtraThickness = 9; | 48 const int kNonClientRestoredExtraThickness = 9; |
49 // In the window corners, the resize areas don't actually expand bigger, but the | 49 // In the window corners, the resize areas don't actually expand bigger, but the |
50 // 16 px at the end of the top and bottom edges triggers diagonal resizing. | 50 // 16 px at the end of the top and bottom edges triggers diagonal resizing. |
51 const int kResizeCornerWidth = 16; | 51 const int kResizeCornerWidth = 16; |
52 // The avatar ends 2 px above the bottom of the tabstrip (which, given the | 52 // Space between the right edge of the incognito icon and the tabstrip. |
53 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the | 53 const int kIncognitoRightSpacing = -2; |
54 // user). | |
55 const int kAvatarBottomSpacing = 2; | |
56 // Space between the frame border and the left edge of the avatar. | |
57 const int kAvatarLeftSpacing = 2; | |
58 // Space between the right edge of the avatar and the tabstrip. | |
59 const int kAvatarRightSpacing = -2; | |
60 // How far the new avatar button is from the left of the minimize button. | 54 // How far the new avatar button is from the left of the minimize button. |
61 const int kNewAvatarButtonOffset = 5; | 55 const int kNewAvatarButtonOffset = 5; |
62 // The content left/right images have a shadow built into them. | 56 // The content left/right images have a shadow built into them. |
63 const int kContentEdgeShadowThickness = 2; | 57 const int kContentEdgeShadowThickness = 2; |
64 // In restored mode, the New Tab button isn't at the same height as the caption | 58 // In restored mode, the New Tab button isn't at the same height as the caption |
65 // buttons, but the space will look cluttered if it actually slides under them, | 59 // buttons, but the space will look cluttered if it actually slides under them, |
66 // so we stop it when the gap between the two is down to 5 px. | 60 // so we stop it when the gap between the two is down to 5 px. |
67 const int kNewTabCaptionRestoredSpacing = 5; | 61 const int kNewTabCaptionRestoredSpacing = 5; |
68 // In maximized mode, where the New Tab button and the caption buttons are at | 62 // In maximized mode, where the New Tab button and the caption buttons are at |
69 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid | 63 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid |
70 // looking too cluttered. | 64 // looking too cluttered. |
71 const int kNewTabCaptionMaximizedSpacing = 16; | 65 const int kNewTabCaptionMaximizedSpacing = 16; |
72 // How far to indent the tabstrip from the left side of the screen when there | 66 // How far to indent the tabstrip from the left side of the screen when there |
73 // is no avatar icon. | 67 // is no incognito icon. |
74 const int kTabStripIndent = -6; | 68 const int kTabStripIndent = -6; |
75 | 69 |
76 // Converts the |image| to a Windows icon and returns the corresponding HICON | 70 // Converts the |image| to a Windows icon and returns the corresponding HICON |
77 // handle. |image| is resized to desired |width| and |height| if needed. | 71 // handle. |image| is resized to desired |width| and |height| if needed. |
78 HICON CreateHICONFromSkBitmapSizedTo(const gfx::ImageSkia& image, | 72 HICON CreateHICONFromSkBitmapSizedTo(const gfx::ImageSkia& image, |
79 int width, | 73 int width, |
80 int height) { | 74 int height) { |
81 if (width == image.width() && height == image.height()) | 75 if (width == image.width() && height == image.height()) |
82 return IconUtil::CreateHICONFromSkBitmap(*image.bitmap()); | 76 return IconUtil::CreateHICONFromSkBitmap(*image.bitmap()); |
83 return IconUtil::CreateHICONFromSkBitmap(skia::ImageOperations::Resize( | 77 return IconUtil::CreateHICONFromSkBitmap(skia::ImageOperations::Resize( |
(...skipping 17 matching lines...) Expand all Loading... |
101 } | 95 } |
102 | 96 |
103 GlassBrowserFrameView::~GlassBrowserFrameView() { | 97 GlassBrowserFrameView::~GlassBrowserFrameView() { |
104 } | 98 } |
105 | 99 |
106 /////////////////////////////////////////////////////////////////////////////// | 100 /////////////////////////////////////////////////////////////////////////////// |
107 // GlassBrowserFrameView, BrowserNonClientFrameView implementation: | 101 // GlassBrowserFrameView, BrowserNonClientFrameView implementation: |
108 | 102 |
109 gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( | 103 gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( |
110 views::View* tabstrip) const { | 104 views::View* tabstrip) const { |
111 int minimize_button_offset = | 105 int end_x = std::min(frame()->GetMinimizeButtonOffset(), width()); |
112 std::min(frame()->GetMinimizeButtonOffset(), width()); | |
113 | 106 |
114 // The new avatar button is optionally displayed to the left of the | 107 // The new avatar button is optionally displayed to the left of the |
115 // minimize button. | 108 // minimize button. |
116 if (new_avatar_button()) { | 109 if (new_avatar_button()) { |
117 minimize_button_offset -= | 110 end_x -= new_avatar_button()->width() + kNewAvatarButtonOffset; |
118 new_avatar_button()->width() + kNewAvatarButtonOffset; | |
119 | 111 |
120 // In non-maximized mode, allow the new tab button to completely slide under | 112 // In non-maximized mode, allow the new tab button to slide completely under |
121 // the avatar button. | 113 // the avatar button. |
122 if (!frame()->IsMaximized() && !base::i18n::IsRTL()) { | 114 if (!frame()->IsMaximized() && !base::i18n::IsRTL()) { |
123 minimize_button_offset += | 115 end_x += |
124 TabStrip::kNewTabButtonAssetWidth + kNewTabCaptionRestoredSpacing; | 116 TabStrip::kNewTabButtonAssetWidth + kNewTabCaptionRestoredSpacing; |
125 } | 117 } |
126 } | 118 } |
127 | 119 |
128 int tabstrip_x = browser_view()->ShouldShowAvatar() ? | 120 int x = browser_view()->ShouldShowAvatar() ? |
129 (avatar_bounds_.right() + kAvatarRightSpacing) : | 121 (incognito_bounds_.right() + kIncognitoRightSpacing) : |
130 NonClientBorderThickness() + kTabStripIndent; | 122 NonClientBorderThickness() + kTabStripIndent; |
131 // In RTL languages, we have moved an avatar icon left by the size of window | 123 // In RTL languages, we have moved an avatar icon left by the size of window |
132 // controls to prevent it from being rendered over them. So, we use its x | 124 // controls to prevent it from being rendered over them. So, we use its x |
133 // position to move this tab strip left when maximized. Also, we can render | 125 // position to move this tab strip left when maximized. Also, we can render |
134 // a tab strip until the left end of this window without considering the size | 126 // a tab strip until the left end of this window without considering the size |
135 // of window controls in RTL languages. | 127 // of window controls in RTL languages. |
136 if (base::i18n::IsRTL()) { | 128 if (base::i18n::IsRTL()) { |
137 if (!browser_view()->ShouldShowAvatar() && frame()->IsMaximized()) { | 129 if (!browser_view()->ShouldShowAvatar() && frame()->IsMaximized()) { |
138 tabstrip_x += avatar_bounds_.x(); | 130 x += incognito_bounds_.x(); |
139 } else if (browser_view()->IsRegularOrGuestSession()) { | 131 } else if (browser_view()->IsRegularOrGuestSession()) { |
140 tabstrip_x = width() - minimize_button_offset; | 132 x = width() - end_x; |
141 } | 133 } |
142 | 134 |
143 minimize_button_offset = width(); | 135 end_x = width(); |
144 } | 136 } |
145 int tabstrip_width = minimize_button_offset - tabstrip_x - | 137 int tabstrip_width = end_x - x - |
146 (frame()->IsMaximized() ? | 138 (frame()->IsMaximized() ? |
147 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); | 139 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); |
148 return gfx::Rect(tabstrip_x, NonClientTopBorderHeight(), | 140 return gfx::Rect(x, NonClientTopBorderHeight(), std::max(0, tabstrip_width), |
149 std::max(0, tabstrip_width), | |
150 tabstrip->GetPreferredSize().height()); | 141 tabstrip->GetPreferredSize().height()); |
151 } | 142 } |
152 | 143 |
153 int GlassBrowserFrameView::GetTopInset() const { | 144 int GlassBrowserFrameView::GetTopInset() const { |
154 return GetClientAreaInsets().top(); | 145 return GetClientAreaInsets().top(); |
155 } | 146 } |
156 | 147 |
157 int GlassBrowserFrameView::GetThemeBackgroundXInset() const { | 148 int GlassBrowserFrameView::GetThemeBackgroundXInset() const { |
158 return 0; | 149 return 0; |
159 } | 150 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 212 } |
222 | 213 |
223 int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) { | 214 int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) { |
224 // If the browser isn't in normal mode, we haven't customized the frame, so | 215 // If the browser isn't in normal mode, we haven't customized the frame, so |
225 // Windows can figure this out. If the point isn't within our bounds, then | 216 // Windows can figure this out. If the point isn't within our bounds, then |
226 // it's in the native portion of the frame, so again Windows can figure it | 217 // it's in the native portion of the frame, so again Windows can figure it |
227 // out. | 218 // out. |
228 if (!browser_view()->IsBrowserTypeNormal() || !bounds().Contains(point)) | 219 if (!browser_view()->IsBrowserTypeNormal() || !bounds().Contains(point)) |
229 return HTNOWHERE; | 220 return HTNOWHERE; |
230 | 221 |
231 // See if the point is within the avatar menu button or within the avatar | 222 // See if the point is within the incognito icon or the new avatar menu. |
232 // label. | 223 if ((avatar_button() && |
233 if (avatar_button() && avatar_button()->GetMirroredBounds().Contains(point)) | 224 avatar_button()->GetMirroredBounds().Contains(point)) || |
234 return HTCLIENT; | 225 (new_avatar_button() && |
235 | 226 new_avatar_button()->GetMirroredBounds().Contains(point))) |
236 if (new_avatar_button() && | |
237 new_avatar_button()->GetMirroredBounds().Contains(point)) | |
238 return HTCLIENT; | 227 return HTCLIENT; |
239 | 228 |
240 int frame_component = frame()->client_view()->NonClientHitTest(point); | 229 int frame_component = frame()->client_view()->NonClientHitTest(point); |
241 | 230 |
242 // See if we're in the sysmenu region. We still have to check the tabstrip | 231 // See if we're in the sysmenu region. We still have to check the tabstrip |
243 // first so that clicks in a tab don't get treated as sysmenu clicks. | 232 // first so that clicks in a tab don't get treated as sysmenu clicks. |
244 int nonclient_border_thickness = NonClientBorderThickness(); | 233 int nonclient_border_thickness = NonClientBorderThickness(); |
245 if (gfx::Rect(nonclient_border_thickness, | 234 if (gfx::Rect(nonclient_border_thickness, |
246 gfx::win::GetSystemMetricsInDIP(SM_CYSIZEFRAME), | 235 gfx::win::GetSystemMetricsInDIP(SM_CYSIZEFRAME), |
247 gfx::win::GetSystemMetricsInDIP(SM_CXSMICON), | 236 gfx::win::GetSystemMetricsInDIP(SM_CXSMICON), |
(...skipping 26 matching lines...) Expand all Loading... |
274 browser_view()->toolbar()->ShouldPaintBackground()) | 263 browser_view()->toolbar()->ShouldPaintBackground()) |
275 PaintToolbarBackground(canvas); | 264 PaintToolbarBackground(canvas); |
276 if (!frame()->IsMaximized()) | 265 if (!frame()->IsMaximized()) |
277 PaintRestoredClientEdge(canvas); | 266 PaintRestoredClientEdge(canvas); |
278 } | 267 } |
279 | 268 |
280 void GlassBrowserFrameView::Layout() { | 269 void GlassBrowserFrameView::Layout() { |
281 if (browser_view()->IsRegularOrGuestSession()) | 270 if (browser_view()->IsRegularOrGuestSession()) |
282 LayoutNewStyleAvatar(); | 271 LayoutNewStyleAvatar(); |
283 else | 272 else |
284 LayoutAvatar(); | 273 LayoutIncognitoIcon(); |
285 | 274 |
286 LayoutClientView(); | 275 LayoutClientView(); |
287 } | 276 } |
288 | 277 |
289 /////////////////////////////////////////////////////////////////////////////// | 278 /////////////////////////////////////////////////////////////////////////////// |
290 // GlassBrowserFrameView, protected: | 279 // GlassBrowserFrameView, protected: |
291 | 280 |
292 // views::ButtonListener: | 281 // views::ButtonListener: |
293 void GlassBrowserFrameView::ButtonPressed(views::Button* sender, | 282 void GlassBrowserFrameView::ButtonPressed(views::Button* sender, |
294 const ui::Event& event) { | 283 const ui::Event& event) { |
(...skipping 16 matching lines...) Expand all Loading... |
311 UpdateNewAvatarButton(this, NewAvatarButton::NATIVE_BUTTON); | 300 UpdateNewAvatarButton(this, NewAvatarButton::NATIVE_BUTTON); |
312 } | 301 } |
313 | 302 |
314 /////////////////////////////////////////////////////////////////////////////// | 303 /////////////////////////////////////////////////////////////////////////////// |
315 // GlassBrowserFrameView, private: | 304 // GlassBrowserFrameView, private: |
316 | 305 |
317 // views::NonClientFrameView: | 306 // views::NonClientFrameView: |
318 bool GlassBrowserFrameView::DoesIntersectRect(const views::View* target, | 307 bool GlassBrowserFrameView::DoesIntersectRect(const views::View* target, |
319 const gfx::Rect& rect) const { | 308 const gfx::Rect& rect) const { |
320 CHECK_EQ(target, this); | 309 CHECK_EQ(target, this); |
321 bool hit_avatar_button = avatar_button() && | 310 bool hit_incognito_icon = avatar_button() && |
322 avatar_button()->GetMirroredBounds().Intersects(rect); | 311 avatar_button()->GetMirroredBounds().Intersects(rect); |
323 bool hit_new_avatar_button = new_avatar_button() && | 312 bool hit_new_avatar_button = new_avatar_button() && |
324 new_avatar_button()->GetMirroredBounds().Intersects(rect); | 313 new_avatar_button()->GetMirroredBounds().Intersects(rect); |
325 return hit_avatar_button || hit_new_avatar_button || | 314 return hit_incognito_icon || hit_new_avatar_button || |
326 !frame()->client_view()->bounds().Intersects(rect); | 315 !frame()->client_view()->bounds().Intersects(rect); |
327 } | 316 } |
328 | 317 |
329 int GlassBrowserFrameView::FrameBorderThickness() const { | 318 int GlassBrowserFrameView::FrameBorderThickness() const { |
330 return (frame()->IsMaximized() || frame()->IsFullscreen()) ? | 319 return (frame()->IsMaximized() || frame()->IsFullscreen()) ? |
331 0 : gfx::win::GetSystemMetricsInDIP(SM_CXSIZEFRAME); | 320 0 : gfx::win::GetSystemMetricsInDIP(SM_CXSIZEFRAME); |
332 } | 321 } |
333 | 322 |
334 int GlassBrowserFrameView::FrameTopBorderHeight() const { | 323 int GlassBrowserFrameView::FrameTopBorderHeight() const { |
335 // We'd like to use FrameBorderThickness() here, but the maximized Aero glass | 324 // We'd like to use FrameBorderThickness() here, but the maximized Aero glass |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 int y = toolbar_bounds.y(); | 369 int y = toolbar_bounds.y(); |
381 int dest_y = browser_view()->IsTabStripVisible() | 370 int dest_y = browser_view()->IsTabStripVisible() |
382 ? y + (kFrameShadowThickness * 2) | 371 ? y + (kFrameShadowThickness * 2) |
383 : y; | 372 : y; |
384 canvas->TileImageInt(*theme_toolbar, | 373 canvas->TileImageInt(*theme_toolbar, |
385 x + GetThemeBackgroundXInset(), | 374 x + GetThemeBackgroundXInset(), |
386 dest_y - GetTopInset(), x, | 375 dest_y - GetTopInset(), x, |
387 dest_y, w, theme_toolbar->height()); | 376 dest_y, w, theme_toolbar->height()); |
388 | 377 |
389 if (browser_view()->IsTabStripVisible()) { | 378 if (browser_view()->IsTabStripVisible()) { |
390 // On Windows 10, we don't draw our own window border but rather go right to | |
391 // the system border, so we don't need to draw the toolbar edges. | |
392 if (base::win::GetVersion() < base::win::VERSION_WIN10) { | 379 if (base::win::GetVersion() < base::win::VERSION_WIN10) { |
393 int left_x = x - kContentEdgeShadowThickness; | 380 int left_x = x - kContentEdgeShadowThickness; |
394 // Draw rounded corners for the tab. | 381 // Draw rounded corners for the tab. |
395 gfx::ImageSkia* toolbar_left_mask = | 382 gfx::ImageSkia* toolbar_left_mask = |
396 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK); | 383 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK); |
397 gfx::ImageSkia* toolbar_right_mask = | 384 gfx::ImageSkia* toolbar_right_mask = |
398 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK); | 385 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK); |
399 | 386 |
400 // We mask out the corners by using the DestinationIn transfer mode, | 387 // We mask out the corners by using the DestinationIn transfer mode, |
401 // which keeps the RGB pixels from the destination and the alpha from | 388 // which keeps the RGB pixels from the destination and the alpha from |
(...skipping 16 matching lines...) Expand all Loading... |
418 | 405 |
419 // Draw center edge. | 406 // Draw center edge. |
420 canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, | 407 canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, |
421 right_x - (left_x + toolbar_left->width()), | 408 right_x - (left_x + toolbar_left->width()), |
422 toolbar_center->height()); | 409 toolbar_center->height()); |
423 | 410 |
424 // Right edge. | 411 // Right edge. |
425 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER), | 412 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER), |
426 right_x, y); | 413 right_x, y); |
427 } else { | 414 } else { |
| 415 // On Windows 10, we don't draw our own window border but rather go right |
| 416 // to the system border, so we don't need to draw the toolbar edges. |
428 canvas->TileImageInt(*toolbar_center, x, y, w, toolbar_center->height()); | 417 canvas->TileImageInt(*toolbar_center, x, y, w, toolbar_center->height()); |
429 } | 418 } |
430 } | 419 } |
431 | 420 |
432 // Draw the content/toolbar separator. | 421 // Draw the content/toolbar separator. |
433 if (ui::MaterialDesignController::IsModeMaterial()) { | 422 if (ui::MaterialDesignController::IsModeMaterial()) { |
434 toolbar_bounds.Inset(kClientEdgeThickness, 0); | 423 toolbar_bounds.Inset(kClientEdgeThickness, 0); |
435 BrowserView::Paint1pxHorizontalLine( | 424 BrowserView::Paint1pxHorizontalLine( |
436 canvas, | 425 canvas, |
437 ThemeProperties::GetDefaultColor( | 426 ThemeProperties::GetDefaultColor( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 // pixel in height, then we place it at the correct position in restored mode, | 513 // pixel in height, then we place it at the correct position in restored mode, |
525 // or one pixel above the top of the screen in maximized mode. | 514 // or one pixel above the top of the screen in maximized mode. |
526 int button_y = frame()->IsMaximized() ? (FrameTopBorderHeight() - 1) : 1; | 515 int button_y = frame()->IsMaximized() ? (FrameTopBorderHeight() - 1) : 1; |
527 new_avatar_button()->SetBounds( | 516 new_avatar_button()->SetBounds( |
528 button_x, | 517 button_x, |
529 button_y, | 518 button_y, |
530 label_size.width(), | 519 label_size.width(), |
531 gfx::win::GetSystemMetricsInDIP(SM_CYMENUSIZE) + 1); | 520 gfx::win::GetSystemMetricsInDIP(SM_CYMENUSIZE) + 1); |
532 } | 521 } |
533 | 522 |
534 void GlassBrowserFrameView::LayoutAvatar() { | 523 void GlassBrowserFrameView::LayoutIncognitoIcon() { |
535 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); | 524 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); |
536 | 525 const gfx::Size size(browser_view()->GetOTRAvatarIcon().size()); |
537 int avatar_x = NonClientBorderThickness() + kAvatarLeftSpacing; | 526 int x = NonClientBorderThickness(); |
538 // Move this avatar icon by the size of window controls to prevent it from | 527 // In RTL, the icon needs to start after the caption buttons. |
539 // being rendered over them in RTL languages. This code also needs to adjust | |
540 // the width of a tab strip to avoid decreasing this size twice. (See the | |
541 // comment in GetBoundsForTabStrip().) | |
542 if (base::i18n::IsRTL()) | 528 if (base::i18n::IsRTL()) |
543 avatar_x += width() - frame()->GetMinimizeButtonOffset(); | 529 x += width() - frame()->GetMinimizeButtonOffset(); |
544 | 530 const int bottom = |
545 int avatar_bottom = GetTopInset() + | 531 GetTopInset() + browser_view()->GetTabStripHeight() - insets.bottom(); |
546 browser_view()->GetTabStripHeight() - kAvatarBottomSpacing; | 532 const int y = frame()->IsMaximized() ? |
547 int avatar_y = frame()->IsMaximized() ? | 533 FrameTopBorderHeight() : (bottom - size.height()); |
548 FrameTopBorderHeight() : (avatar_bottom - incognito_icon.height()); | 534 incognito_bounds_.SetRect(x + insets.left(), y, size.width(), |
549 avatar_bounds_.SetRect(avatar_x, avatar_y, incognito_icon.width(), | 535 browser_view()->ShouldShowAvatar() ? (bottom - y) : 0); |
550 browser_view()->ShouldShowAvatar() ? (avatar_bottom - avatar_y) : 0); | |
551 if (avatar_button()) | 536 if (avatar_button()) |
552 avatar_button()->SetBoundsRect(avatar_bounds_); | 537 avatar_button()->SetBoundsRect(incognito_bounds_); |
553 } | 538 } |
554 | 539 |
555 void GlassBrowserFrameView::LayoutClientView() { | 540 void GlassBrowserFrameView::LayoutClientView() { |
556 client_view_bounds_ = CalculateClientAreaBounds(width(), height()); | 541 client_view_bounds_ = CalculateClientAreaBounds(width(), height()); |
557 } | 542 } |
558 | 543 |
559 gfx::Insets GlassBrowserFrameView::GetClientAreaInsets() const { | 544 gfx::Insets GlassBrowserFrameView::GetClientAreaInsets() const { |
560 if (!browser_view()->IsTabStripVisible()) | 545 if (!browser_view()->IsTabStripVisible()) |
561 return gfx::Insets(); | 546 return gfx::Insets(); |
562 | 547 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 static bool initialized = false; | 632 static bool initialized = false; |
648 if (!initialized) { | 633 if (!initialized) { |
649 for (int i = 0; i < kThrobberIconCount; ++i) { | 634 for (int i = 0; i < kThrobberIconCount; ++i) { |
650 throbber_icons_[i] = | 635 throbber_icons_[i] = |
651 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 636 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
652 DCHECK(throbber_icons_[i]); | 637 DCHECK(throbber_icons_[i]); |
653 } | 638 } |
654 initialized = true; | 639 initialized = true; |
655 } | 640 } |
656 } | 641 } |
OLD | NEW |