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

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: mac 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/browser_process.h"
19 #include "chrome/browser/prefs/pref_service.h" 20 #include "chrome/browser/prefs/pref_service.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/profiles/profile_info_cache.h"
21 #include "chrome/browser/profiles/profile_manager.h" 23 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/gtk/accelerators_gtk.h" 25 #include "chrome/browser/ui/gtk/accelerators_gtk.h"
24 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 26 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
25 #include "chrome/browser/ui/gtk/custom_button.h" 27 #include "chrome/browser/ui/gtk/custom_button.h"
26 #if defined(USE_GCONF) 28 #if defined(USE_GCONF)
27 #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h" 29 #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h"
28 #endif 30 #endif
29 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 31 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
30 #include "chrome/browser/ui/gtk/gtk_util.h" 32 #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); 305 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); 306 gtk_widget_set_no_show_all(titlebar_left_spy_frame_, TRUE);
305 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_left_spy_frame_), 0, 307 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_left_spy_frame_), 0,
306 kOTRBottomSpacing, kOTRSideSpacing, kOTRSideSpacing); 308 kOTRBottomSpacing, kOTRSideSpacing, kOTRSideSpacing);
307 gtk_box_pack_start(GTK_BOX(container_hbox_), titlebar_left_spy_frame_, 309 gtk_box_pack_start(GTK_BOX(container_hbox_), titlebar_left_spy_frame_,
308 FALSE, FALSE, 0); 310 FALSE, FALSE, 0);
309 } 311 }
310 312
311 // If multi-profile is enabled set up profile button and login notifications. 313 // If multi-profile is enabled set up profile button and login notifications.
312 // The button lives in its own vbox in container_hbox_. 314 // The button lives in its own vbox in container_hbox_.
315 ProfileInfoCache& cache =
316 g_browser_process->profile_manager()->GetProfileInfoCache();
313 if (ProfileManager::IsMultipleProfilesEnabled() && 317 if (ProfileManager::IsMultipleProfilesEnabled() &&
318 cache.GetNumberOfProfiles() > 1 &&
314 !browser_window_->browser()->profile()->IsOffTheRecord()) { 319 !browser_window_->browser()->profile()->IsOffTheRecord()) {
315 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); 320 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs();
316 usernamePref_.Init(prefs::kGoogleServicesUsername, prefs, this); 321 usernamePref_.Init(prefs::kGoogleServicesUsername, prefs, this);
317 322
318 titlebar_profile_vbox_ = gtk_vbox_new(FALSE, 0); 323 titlebar_profile_vbox_ = gtk_vbox_new(FALSE, 0);
319 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_profile_vbox_, 324 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_profile_vbox_,
320 FALSE, FALSE, 0); 325 FALSE, FALSE, 0);
321 gtk_widget_show_all(titlebar_profile_vbox_); 326 gtk_widget_show_all(titlebar_profile_vbox_);
322 327
323 profile_button_.reset(new ProfileMenuButton( 328 profile_button_.reset(new ProfileMenuButton(
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 ui::SimpleMenuModel::Delegate* delegate) 1047 ui::SimpleMenuModel::Delegate* delegate)
1043 : SimpleMenuModel(delegate) { 1048 : SimpleMenuModel(delegate) {
1044 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); 1049 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB);
1045 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); 1050 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB);
1046 AddSeparator(); 1051 AddSeparator();
1047 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); 1052 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER);
1048 AddSeparator(); 1053 AddSeparator();
1049 AddCheckItemWithStringId(kShowWindowDecorationsCommand, 1054 AddCheckItemWithStringId(kShowWindowDecorationsCommand,
1050 IDS_SHOW_WINDOW_DECORATIONS_MENU); 1055 IDS_SHOW_WINDOW_DECORATIONS_MENU);
1051 } 1056 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698