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/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/avatar_menu.h" | 9 #include "chrome/browser/profiles/avatar_menu.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 BrowserNonClientFrameView::~BrowserNonClientFrameView() { | 48 BrowserNonClientFrameView::~BrowserNonClientFrameView() { |
49 // The profile manager may by null in tests. | 49 // The profile manager may by null in tests. |
50 if (g_browser_process->profile_manager()) { | 50 if (g_browser_process->profile_manager()) { |
51 g_browser_process->profile_manager()-> | 51 g_browser_process->profile_manager()-> |
52 GetProfileAttributesStorage().RemoveObserver(this); | 52 GetProfileAttributesStorage().RemoveObserver(this); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 void BrowserNonClientFrameView::OnBrowserViewInitViewsComplete() {} | 56 void BrowserNonClientFrameView::OnBrowserViewInitViewsComplete() {} |
57 | 57 |
58 gfx::ImageSkia BrowserNonClientFrameView::GetOTRAvatarIcon() const { | 58 gfx::ImageSkia BrowserNonClientFrameView::GetIncognitoAvatarIcon() const { |
59 if (!ui::MaterialDesignController::IsModeMaterial()) | 59 if (!ui::MaterialDesignController::IsModeMaterial()) |
60 return *GetThemeProviderForProfile()->GetImageSkiaNamed(IDR_OTR_ICON); | 60 return *GetThemeProviderForProfile()->GetImageSkiaNamed(IDR_OTR_ICON); |
61 const SkColor icon_color = color_utils::PickContrastingColor( | 61 const SkColor icon_color = color_utils::PickContrastingColor( |
62 SK_ColorWHITE, gfx::kChromeIconGrey, GetFrameColor()); | 62 SK_ColorWHITE, gfx::kChromeIconGrey, GetFrameColor()); |
63 return gfx::CreateVectorIcon(gfx::VectorIconId::INCOGNITO, icon_color); | 63 return gfx::CreateVectorIcon(gfx::VectorIconId::INCOGNITO, icon_color); |
64 } | 64 } |
65 | 65 |
66 SkColor BrowserNonClientFrameView::GetToolbarTopSeparatorColor() const { | 66 SkColor BrowserNonClientFrameView::GetToolbarTopSeparatorColor() const { |
67 const auto color_id = | 67 const auto color_id = |
68 ShouldPaintAsActive() | 68 ShouldPaintAsActive() |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 profile_indicator_icon_->set_id(VIEW_ID_PROFILE_INDICATOR_ICON); | 163 profile_indicator_icon_->set_id(VIEW_ID_PROFILE_INDICATOR_ICON); |
164 AddChildView(profile_indicator_icon_); | 164 AddChildView(profile_indicator_icon_); |
165 // Invalidate here because adding a child does not invalidate the layout. | 165 // Invalidate here because adding a child does not invalidate the layout. |
166 InvalidateLayout(); | 166 InvalidateLayout(); |
167 frame_->GetRootView()->Layout(); | 167 frame_->GetRootView()->Layout(); |
168 } | 168 } |
169 | 169 |
170 gfx::Image icon; | 170 gfx::Image icon; |
171 const Profile* profile = browser_view()->browser()->profile(); | 171 const Profile* profile = browser_view()->browser()->profile(); |
172 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) { | 172 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) { |
173 icon = gfx::Image(GetOTRAvatarIcon()); | 173 icon = gfx::Image(GetIncognitoAvatarIcon()); |
174 if (!ui::MaterialDesignController::IsModeMaterial()) | 174 if (!ui::MaterialDesignController::IsModeMaterial()) |
175 profile_indicator_icon_->EnableCanvasFlippingForRTLUI(true); | 175 profile_indicator_icon_->EnableCanvasFlippingForRTLUI(true); |
176 } else { | 176 } else { |
177 #if defined(OS_CHROMEOS) | 177 #if defined(OS_CHROMEOS) |
178 AvatarMenu::GetImageForMenuButton(profile->GetPath(), &icon); | 178 AvatarMenu::GetImageForMenuButton(profile->GetPath(), &icon); |
179 #else | 179 #else |
180 NOTREACHED(); | 180 NOTREACHED(); |
181 #endif | 181 #endif |
182 } | 182 } |
183 | 183 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // safety. See crbug.com/313800. | 255 // safety. See crbug.com/313800. |
256 gfx::Image decoration; | 256 gfx::Image decoration; |
257 AvatarMenu::GetImageForMenuButton( | 257 AvatarMenu::GetImageForMenuButton( |
258 browser_view()->browser()->profile()->GetPath(), &decoration); | 258 browser_view()->browser()->profile()->GetPath(), &decoration); |
259 // This can happen if the user deletes the current profile. | 259 // This can happen if the user deletes the current profile. |
260 if (decoration.IsEmpty()) | 260 if (decoration.IsEmpty()) |
261 return; | 261 return; |
262 chrome::DrawTaskbarDecoration(frame_->GetNativeWindow(), &decoration); | 262 chrome::DrawTaskbarDecoration(frame_->GetNativeWindow(), &decoration); |
263 #endif | 263 #endif |
264 } | 264 } |
OLD | NEW |