Chromium Code Reviews| 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 "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 client_area_bottom + kClientEdgeThickness - client_area_top), | 440 client_area_bottom + kClientEdgeThickness - client_area_top), |
| 441 toolbar_color); | 441 toolbar_color); |
| 442 } | 442 } |
| 443 | 443 |
| 444 void GlassBrowserFrameView::LayoutNewStyleAvatar() { | 444 void GlassBrowserFrameView::LayoutNewStyleAvatar() { |
| 445 DCHECK(switches::IsNewAvatarMenu()); | 445 DCHECK(switches::IsNewAvatarMenu()); |
| 446 if (!new_avatar_button()) | 446 if (!new_avatar_button()) |
| 447 return; | 447 return; |
| 448 | 448 |
| 449 gfx::Size label_size = new_avatar_button()->GetPreferredSize(); | 449 gfx::Size label_size = new_avatar_button()->GetPreferredSize(); |
| 450 int button_size_with_offset = kNewAvatarButtonOffset + label_size.width(); | |
| 451 | 450 |
| 452 int button_x = frame()->GetMinimizeButtonOffset() - | 451 int button_x = frame()->GetMinimizeButtonOffset() - |
| 453 kNewAvatarButtonOffset - label_size.width(); | 452 kNewAvatarButtonOffset - label_size.width(); |
| 454 if (base::i18n::IsRTL()) | 453 if (base::i18n::IsRTL()) |
| 455 button_x = width() - frame()->GetMinimizeButtonOffset() + | 454 button_x = width() - frame()->GetMinimizeButtonOffset() + |
| 456 kNewAvatarButtonOffset; | 455 kNewAvatarButtonOffset; |
| 457 int button_y = frame()->IsMaximized() ? NonClientTopBorderHeight() : 1; | |
| 458 | 456 |
| 459 // If the window is maximized, the button is 2 pixels too tall. Determined | 457 // We need to offset the button correctly in maximized mode, so that the |
| 460 // via visual inspection. | 458 // custom glass style aligns with the native control glass style. The |
| 461 int height_to_subtract = frame()->IsMaximized() ? 2 : 0; | 459 // glass shadow is off by 1px, which was determined by visual inspection. |
| 460 const int maximized_frame_offset = | |
| 461 NonClientTopBorderHeight() + kTabstripTopShadowThickness - 1; | |
|
msw
2014/06/19 04:10:17
optional nit: inline this below (and negate the te
noms (inactive)
2014/06/19 15:10:55
Done.
| |
| 462 int button_y = frame()->IsMaximized() ? maximized_frame_offset : 1; | |
| 462 | 463 |
| 463 new_avatar_button()->SetBounds( | 464 new_avatar_button()->SetBounds( |
| 464 button_x, | 465 button_x, |
| 465 button_y, | 466 button_y, |
| 466 label_size.width(), | 467 label_size.width(), |
| 467 button_y + gfx::win::GetSystemMetricsInDIP(SM_CXMENUSIZE) - | 468 gfx::win::GetSystemMetricsInDIP(SM_CYMENUSIZE) + 1); |
| 468 height_to_subtract); | |
| 469 } | 469 } |
| 470 | 470 |
| 471 void GlassBrowserFrameView::LayoutAvatar() { | 471 void GlassBrowserFrameView::LayoutAvatar() { |
| 472 // Even though the avatar is used for both incognito and profiles we always | 472 // Even though the avatar is used for both incognito and profiles we always |
| 473 // use the incognito icon to layout the avatar button. The profile icon | 473 // use the incognito icon to layout the avatar button. The profile icon |
| 474 // can be customized so we can't depend on its size to perform layout. | 474 // can be customized so we can't depend on its size to perform layout. |
| 475 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); | 475 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); |
| 476 | 476 |
| 477 int avatar_x = NonClientBorderThickness() + kAvatarLeftSpacing; | 477 int avatar_x = NonClientBorderThickness() + kAvatarLeftSpacing; |
| 478 // Move this avatar icon by the size of window controls to prevent it from | 478 // Move this avatar icon by the size of window controls to prevent it from |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 static bool initialized = false; | 587 static bool initialized = false; |
| 588 if (!initialized) { | 588 if (!initialized) { |
| 589 for (int i = 0; i < kThrobberIconCount; ++i) { | 589 for (int i = 0; i < kThrobberIconCount; ++i) { |
| 590 throbber_icons_[i] = | 590 throbber_icons_[i] = |
| 591 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 591 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
| 592 DCHECK(throbber_icons_[i]); | 592 DCHECK(throbber_icons_[i]); |
| 593 } | 593 } |
| 594 initialized = true; | 594 initialized = true; |
| 595 } | 595 } |
| 596 } | 596 } |
| OLD | NEW |