Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view.cc

Issue 1785643002: Update avatar icon when nonclient frame view is added to view hierarchy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More consistent calling of GetNativeWindow() Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 &taskbar_badge_avatar, &is_rectangle)) 182 &taskbar_badge_avatar, &is_rectangle))
183 return; 183 return;
184 184
185 // Disable the menu when we should not show the menu. 185 // Disable the menu when we should not show the menu.
186 if (avatar_button_ && !AvatarMenu::ShouldShowAvatarMenu()) 186 if (avatar_button_ && !AvatarMenu::ShouldShowAvatarMenu())
187 avatar_button_->SetEnabled(false); 187 avatar_button_->SetEnabled(false);
188 if (avatar_button_) 188 if (avatar_button_)
189 avatar_button_->SetAvatarIcon(avatar, is_rectangle); 189 avatar_button_->SetAvatarIcon(avatar, is_rectangle);
190 } 190 }
191 191
192 void BrowserNonClientFrameView::ViewHierarchyChanged(
193 const ViewHierarchyChangedDetails& details) {
194 if (details.is_add && details.child == this)
195 UpdateAvatar();
196 }
197
192 void BrowserNonClientFrameView::OnProfileAdded( 198 void BrowserNonClientFrameView::OnProfileAdded(
193 const base::FilePath& profile_path) { 199 const base::FilePath& profile_path) {
194 OnProfileAvatarChanged(profile_path); 200 OnProfileAvatarChanged(profile_path);
195 } 201 }
196 202
197 void BrowserNonClientFrameView::OnProfileWasRemoved( 203 void BrowserNonClientFrameView::OnProfileWasRemoved(
198 const base::FilePath& profile_path, 204 const base::FilePath& profile_path,
199 const base::string16& profile_name) { 205 const base::string16& profile_name) {
200 OnProfileAvatarChanged(profile_path); 206 OnProfileAvatarChanged(profile_path);
201 } 207 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const ProfileAttributesStorage& storage = 246 const ProfileAttributesStorage& storage =
241 g_browser_process->profile_manager()->GetProfileAttributesStorage(); 247 g_browser_process->profile_manager()->GetProfileAttributesStorage();
242 show_decoration = show_decoration && storage.GetNumberOfProfiles() > 1; 248 show_decoration = show_decoration && storage.GetNumberOfProfiles() > 1;
243 } 249 }
244 chrome::DrawTaskbarDecoration(frame_->GetNativeWindow(), 250 chrome::DrawTaskbarDecoration(frame_->GetNativeWindow(),
245 show_decoration 251 show_decoration
246 ? (taskbar_badge_avatar.IsEmpty() ? &avatar : &taskbar_badge_avatar) 252 ? (taskbar_badge_avatar.IsEmpty() ? &avatar : &taskbar_badge_avatar)
247 : nullptr); 253 : nullptr);
248 } 254 }
249 } 255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698