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

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

Issue 7331017: Multi-Profiles: Add icon chooser to profiles menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Multi-Profiles: Add icon chooser to profiles menu Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/frame/glass_browser_frame_view.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/profiles/profile_info_cache.h" 13 #include "chrome/browser/profiles/profile_info_cache.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/themes/theme_service.h" 15 #include "chrome/browser/themes/theme_service.h"
16 #include "chrome/browser/ui/profile_menu_model.h"
17 #include "chrome/browser/ui/views/avatar_menu_button.h" 16 #include "chrome/browser/ui/views/avatar_menu_button.h"
18 #include "chrome/browser/ui/views/frame/browser_frame.h" 17 #include "chrome/browser/ui/views/frame/browser_frame.h"
19 #include "chrome/browser/ui/views/frame/browser_view.h" 18 #include "chrome/browser/ui/views/frame/browser_view.h"
20 #include "chrome/browser/ui/views/tabs/tab_strip.h" 19 #include "chrome/browser/ui/views/tabs/tab_strip.h"
21 #include "chrome/browser/ui/views/toolbar_view.h" 20 #include "chrome/browser/ui/views/toolbar_view.h"
22 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
24 #include "content/browser/tab_contents/tab_contents.h" 23 #include "content/browser/tab_contents/tab_contents.h"
25 #include "content/common/notification_service.h" 24 #include "content/common/notification_service.h"
26 #include "grit/chromium_strings.h" 25 #include "grit/chromium_strings.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 194
196 // Initializing the TabIconView is expensive, so only do it if we need to. 195 // Initializing the TabIconView is expensive, so only do it if we need to.
197 if (browser_view_->ShouldShowWindowIcon()) { 196 if (browser_view_->ShouldShowWindowIcon()) {
198 window_icon_ = new TabIconView(this); 197 window_icon_ = new TabIconView(this);
199 window_icon_->set_is_light(true); 198 window_icon_->set_is_light(true);
200 AddChildView(window_icon_); 199 AddChildView(window_icon_);
201 window_icon_->Update(); 200 window_icon_->Update();
202 } 201 }
203 202
204 if (browser_view_->ShouldShowAvatar()) { 203 if (browser_view_->ShouldShowAvatar()) {
205 ui::MenuModel* menu_model = browser_view_->IsOffTheRecord() ? 204 avatar_button_.reset(new AvatarMenuButton(
206 NULL : new ProfileMenuModel(browser_view_->browser()); 205 browser_view_->browser(), !browser_view_->IsOffTheRecord()));
207 // AvatarMenuButton takes ownership of |menu_model|.
208 avatar_button_.reset(new AvatarMenuButton(std::wstring(), menu_model));
209 AddChildView(avatar_button_.get()); 206 AddChildView(avatar_button_.get());
210 UpdateAvatarInfo(); 207 UpdateAvatarInfo();
211 if (!browser_view_->IsOffTheRecord()) { 208 if (!browser_view_->IsOffTheRecord()) {
212 registrar_.Add(this, NotificationType::PROFILE_CACHED_INFO_CHANGED, 209 registrar_.Add(this, NotificationType::PROFILE_CACHED_INFO_CHANGED,
213 NotificationService::AllSources()); 210 NotificationService::AllSources());
214 } 211 }
215 } 212 }
216 } 213 }
217 214
218 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() { 215 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() {
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 g_browser_process->profile_manager()->GetProfileInfoCache(); 1159 g_browser_process->profile_manager()->GetProfileInfoCache();
1163 Profile* profile = browser_view_->browser()->profile(); 1160 Profile* profile = browser_view_->browser()->profile();
1164 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 1161 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
1165 if (index != std::string::npos) { 1162 if (index != std::string::npos) {
1166 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index)); 1163 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index));
1167 avatar_button_->SetText(UTF16ToWideHack( 1164 avatar_button_->SetText(UTF16ToWideHack(
1168 cache.GetNameOfProfileAtIndex(index))); 1165 cache.GetNameOfProfileAtIndex(index)));
1169 } 1166 }
1170 } 1167 }
1171 } 1168 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/glass_browser_frame_view.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698