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

Side by Side Diff: chrome/browser/ui/gtk/browser_titlebar.cc

Issue 7484040: Multi-Profiles: Only show the avatar icon if user has multiple profiles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed review comments Created 9 years, 4 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
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/gtk/browser_titlebar.h" 5 #include "chrome/browser/ui/gtk/browser_titlebar.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/string_piece.h" 15 #include "base/string_piece.h"
16 #include "base/string_tokenizer.h" 16 #include "base/string_tokenizer.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "chrome/app/chrome_command_ids.h" 18 #include "chrome/app/chrome_command_ids.h"
19 #include "chrome/browser/prefs/pref_service.h" 19 #include "chrome/browser/prefs/pref_service.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_info_cache.h"
21 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/gtk/accelerators_gtk.h" 24 #include "chrome/browser/ui/gtk/accelerators_gtk.h"
24 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 25 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
25 #include "chrome/browser/ui/gtk/custom_button.h" 26 #include "chrome/browser/ui/gtk/custom_button.h"
26 #if defined(USE_GCONF) 27 #if defined(USE_GCONF)
27 #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h" 28 #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h"
28 #endif 29 #endif
29 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 30 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
30 #include "chrome/browser/ui/gtk/gtk_util.h" 31 #include "chrome/browser/ui/gtk/gtk_util.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 titlebar_left_spy_frame_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); 304 titlebar_left_spy_frame_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
304 gtk_widget_set_no_show_all(titlebar_left_spy_frame_, TRUE); 305 gtk_widget_set_no_show_all(titlebar_left_spy_frame_, TRUE);
305 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_left_spy_frame_), 0, 306 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_left_spy_frame_), 0,
306 kOTRBottomSpacing, kOTRSideSpacing, kOTRSideSpacing); 307 kOTRBottomSpacing, kOTRSideSpacing, kOTRSideSpacing);
307 gtk_box_pack_start(GTK_BOX(container_hbox_), titlebar_left_spy_frame_, 308 gtk_box_pack_start(GTK_BOX(container_hbox_), titlebar_left_spy_frame_,
308 FALSE, FALSE, 0); 309 FALSE, FALSE, 0);
309 } 310 }
310 311
311 // If multi-profile is enabled set up profile button and login notifications. 312 // If multi-profile is enabled set up profile button and login notifications.
312 // The button lives in its own vbox in container_hbox_. 313 // The button lives in its own vbox in container_hbox_.
314 ProfileInfoCache& cache =
315 g_browser_process->profile_manager()->GetProfileInfoCache();
313 if (ProfileManager::IsMultipleProfilesEnabled() && 316 if (ProfileManager::IsMultipleProfilesEnabled() &&
317 cache.GetNumberOfProfiles() > 1 &&
314 !browser_window_->browser()->profile()->IsOffTheRecord()) { 318 !browser_window_->browser()->profile()->IsOffTheRecord()) {
315 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); 319 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs();
316 usernamePref_.Init(prefs::kGoogleServicesUsername, prefs, this); 320 usernamePref_.Init(prefs::kGoogleServicesUsername, prefs, this);
317 321
318 titlebar_profile_vbox_ = gtk_vbox_new(FALSE, 0); 322 titlebar_profile_vbox_ = gtk_vbox_new(FALSE, 0);
319 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_profile_vbox_, 323 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_profile_vbox_,
320 FALSE, FALSE, 0); 324 FALSE, FALSE, 0);
321 gtk_widget_show_all(titlebar_profile_vbox_); 325 gtk_widget_show_all(titlebar_profile_vbox_);
322 326
323 profile_button_.reset(new ProfileMenuButton( 327 profile_button_.reset(new ProfileMenuButton(
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 ui::SimpleMenuModel::Delegate* delegate) 1046 ui::SimpleMenuModel::Delegate* delegate)
1043 : SimpleMenuModel(delegate) { 1047 : SimpleMenuModel(delegate) {
1044 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); 1048 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB);
1045 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); 1049 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB);
1046 AddSeparator(); 1050 AddSeparator();
1047 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); 1051 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER);
1048 AddSeparator(); 1052 AddSeparator();
1049 AddCheckItemWithStringId(kShowWindowDecorationsCommand, 1053 AddCheckItemWithStringId(kShowWindowDecorationsCommand,
1050 IDS_SHOW_WINDOW_DECORATIONS_MENU); 1054 IDS_SHOW_WINDOW_DECORATIONS_MENU);
1051 } 1055 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698