OLD | NEW |
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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 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); |
305 gtk_widget_set_no_show_all(titlebar_left_spy_frame_, TRUE); | 306 gtk_widget_set_no_show_all(titlebar_left_spy_frame_, TRUE); |
306 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_left_spy_frame_), 0, | 307 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_left_spy_frame_), 0, |
307 kOTRBottomSpacing, kOTRSideSpacing, kOTRSideSpacing); | 308 kOTRBottomSpacing, kOTRSideSpacing, kOTRSideSpacing); |
308 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_, |
309 FALSE, FALSE, 0); | 310 FALSE, FALSE, 0); |
310 } | 311 } |
311 | 312 |
312 // 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. |
313 // 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(); |
314 if (ProfileManager::IsMultipleProfilesEnabled() && | 317 if (ProfileManager::IsMultipleProfilesEnabled() && |
| 318 cache.GetNumberOfProfiles() > 1 && |
315 !browser_window_->browser()->profile()->IsOffTheRecord()) { | 319 !browser_window_->browser()->profile()->IsOffTheRecord()) { |
316 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); | 320 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); |
317 usernamePref_.Init(prefs::kGoogleServicesUsername, prefs, this); | 321 usernamePref_.Init(prefs::kGoogleServicesUsername, prefs, this); |
318 | 322 |
319 titlebar_profile_vbox_ = gtk_vbox_new(FALSE, 0); | 323 titlebar_profile_vbox_ = gtk_vbox_new(FALSE, 0); |
320 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_profile_vbox_, | 324 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_profile_vbox_, |
321 FALSE, FALSE, 0); | 325 FALSE, FALSE, 0); |
322 gtk_widget_show_all(titlebar_profile_vbox_); | 326 gtk_widget_show_all(titlebar_profile_vbox_); |
323 | 327 |
324 profile_button_.reset(new ProfileMenuButton( | 328 profile_button_.reset(new ProfileMenuButton( |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 ui::SimpleMenuModel::Delegate* delegate) | 1047 ui::SimpleMenuModel::Delegate* delegate) |
1044 : SimpleMenuModel(delegate) { | 1048 : SimpleMenuModel(delegate) { |
1045 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); | 1049 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); |
1046 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); | 1050 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); |
1047 AddSeparator(); | 1051 AddSeparator(); |
1048 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 1052 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
1049 AddSeparator(); | 1053 AddSeparator(); |
1050 AddCheckItemWithStringId(kShowWindowDecorationsCommand, | 1054 AddCheckItemWithStringId(kShowWindowDecorationsCommand, |
1051 IDS_SHOW_WINDOW_DECORATIONS_MENU); | 1055 IDS_SHOW_WINDOW_DECORATIONS_MENU); |
1052 } | 1056 } |
OLD | NEW |