| 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/browser_non_client_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/app/vector_icons/vector_icons.h" | 8 #include "chrome/app/vector_icons/vector_icons.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/avatar_menu.h" | 10 #include "chrome/browser/profiles/avatar_menu.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 BrowserNonClientFrameView::~BrowserNonClientFrameView() { | 42 BrowserNonClientFrameView::~BrowserNonClientFrameView() { |
| 43 // The profile manager may by null in tests. | 43 // The profile manager may by null in tests. |
| 44 if (g_browser_process->profile_manager()) { | 44 if (g_browser_process->profile_manager()) { |
| 45 g_browser_process->profile_manager()-> | 45 g_browser_process->profile_manager()-> |
| 46 GetProfileAttributesStorage().RemoveObserver(this); | 46 GetProfileAttributesStorage().RemoveObserver(this); |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 void BrowserNonClientFrameView::OnBrowserViewInitViewsComplete() {} | 50 void BrowserNonClientFrameView::OnBrowserViewInitViewsComplete() { |
| 51 UpdateMinimumSize(); |
| 52 } |
| 51 | 53 |
| 52 gfx::ImageSkia BrowserNonClientFrameView::GetIncognitoAvatarIcon() const { | 54 gfx::ImageSkia BrowserNonClientFrameView::GetIncognitoAvatarIcon() const { |
| 53 const SkColor icon_color = color_utils::PickContrastingColor( | 55 const SkColor icon_color = color_utils::PickContrastingColor( |
| 54 SK_ColorWHITE, gfx::kChromeIconGrey, GetFrameColor()); | 56 SK_ColorWHITE, gfx::kChromeIconGrey, GetFrameColor()); |
| 55 return gfx::CreateVectorIcon(kIncognitoIcon, icon_color); | 57 return gfx::CreateVectorIcon(kIncognitoIcon, icon_color); |
| 56 } | 58 } |
| 57 | 59 |
| 58 SkColor BrowserNonClientFrameView::GetToolbarTopSeparatorColor() const { | 60 SkColor BrowserNonClientFrameView::GetToolbarTopSeparatorColor() const { |
| 59 const auto color_id = | 61 const auto color_id = |
| 60 ShouldPaintAsActive() | 62 ShouldPaintAsActive() |
| 61 ? ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR | 63 ? ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR |
| 62 : ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE; | 64 : ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE; |
| 63 return ShouldPaintAsThemed() ? GetThemeProvider()->GetColor(color_id) | 65 return ShouldPaintAsThemed() ? GetThemeProvider()->GetColor(color_id) |
| 64 : ThemeProperties::GetDefaultColor( | 66 : ThemeProperties::GetDefaultColor( |
| 65 color_id, browser_view_->IsIncognito()); | 67 color_id, browser_view_->IsIncognito()); |
| 66 } | 68 } |
| 67 | 69 |
| 68 views::View* BrowserNonClientFrameView::GetProfileSwitcherView() const { | 70 views::View* BrowserNonClientFrameView::GetProfileSwitcherView() const { |
| 69 return nullptr; | 71 return nullptr; |
| 70 } | 72 } |
| 71 | 73 |
| 72 void BrowserNonClientFrameView::UpdateClientArea() {} | 74 void BrowserNonClientFrameView::UpdateClientArea() {} |
| 73 | 75 |
| 76 void BrowserNonClientFrameView::UpdateMinimumSize() {} |
| 77 |
| 74 void BrowserNonClientFrameView::ChildPreferredSizeChanged(views::View* child) { | 78 void BrowserNonClientFrameView::ChildPreferredSizeChanged(views::View* child) { |
| 75 if (child == GetProfileSwitcherView()) { | 79 if (child == GetProfileSwitcherView()) { |
| 76 // Perform a re-layout if the avatar button has changed, since that can | 80 // Perform a re-layout if the avatar button has changed, since that can |
| 77 // affect the size of the tabs. | 81 // affect the size of the tabs. |
| 78 frame()->GetRootView()->Layout(); | 82 frame()->GetRootView()->Layout(); |
| 79 } | 83 } |
| 80 } | 84 } |
| 81 | 85 |
| 82 void BrowserNonClientFrameView::VisibilityChanged(views::View* starting_from, | 86 void BrowserNonClientFrameView::VisibilityChanged(views::View* starting_from, |
| 83 bool is_visible) { | 87 bool is_visible) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // safety. See crbug.com/313800. | 283 // safety. See crbug.com/313800. |
| 280 gfx::Image decoration; | 284 gfx::Image decoration; |
| 281 AvatarMenu::GetImageForMenuButton( | 285 AvatarMenu::GetImageForMenuButton( |
| 282 browser_view()->browser()->profile()->GetPath(), &decoration); | 286 browser_view()->browser()->profile()->GetPath(), &decoration); |
| 283 // This can happen if the user deletes the current profile. | 287 // This can happen if the user deletes the current profile. |
| 284 if (decoration.IsEmpty()) | 288 if (decoration.IsEmpty()) |
| 285 return; | 289 return; |
| 286 chrome::DrawTaskbarDecoration(frame_->GetNativeWindow(), &decoration); | 290 chrome::DrawTaskbarDecoration(frame_->GetNativeWindow(), &decoration); |
| 287 #endif | 291 #endif |
| 288 } | 292 } |
| OLD | NEW |