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_manager.h" |
21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/gtk/accelerators_gtk.h" | 23 #include "chrome/browser/ui/gtk/accelerators_gtk.h" |
23 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 24 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
24 #include "chrome/browser/ui/gtk/custom_button.h" | 25 #include "chrome/browser/ui/gtk/custom_button.h" |
25 #if defined(USE_GCONF) | 26 #if defined(USE_GCONF) |
26 #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h" | 27 #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h" |
27 #endif | 28 #endif |
28 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 29 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
29 #include "chrome/browser/ui/gtk/gtk_util.h" | 30 #include "chrome/browser/ui/gtk/gtk_util.h" |
30 #include "chrome/browser/ui/gtk/menu_gtk.h" | 31 #include "chrome/browser/ui/gtk/menu_gtk.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 titlebar_left_spy_frame_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 303 titlebar_left_spy_frame_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
303 gtk_widget_set_no_show_all(titlebar_left_spy_frame_, TRUE); | 304 gtk_widget_set_no_show_all(titlebar_left_spy_frame_, TRUE); |
304 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_left_spy_frame_), 0, | 305 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_left_spy_frame_), 0, |
305 kOTRBottomSpacing, kOTRSideSpacing, kOTRSideSpacing); | 306 kOTRBottomSpacing, kOTRSideSpacing, kOTRSideSpacing); |
306 gtk_box_pack_start(GTK_BOX(container_hbox_), titlebar_left_spy_frame_, | 307 gtk_box_pack_start(GTK_BOX(container_hbox_), titlebar_left_spy_frame_, |
307 FALSE, FALSE, 0); | 308 FALSE, FALSE, 0); |
308 } | 309 } |
309 | 310 |
310 // If multi-profile is enabled set up profile button and login notifications. | 311 // If multi-profile is enabled set up profile button and login notifications. |
311 // The button lives in its own vbox in container_hbox_. | 312 // The button lives in its own vbox in container_hbox_. |
312 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 313 if (ProfileManager::IsMultipleProfilesEnabled() && |
313 if (browser_command_line.HasSwitch(switches::kMultiProfiles) && | |
314 !browser_window_->browser()->profile()->IsOffTheRecord()) { | 314 !browser_window_->browser()->profile()->IsOffTheRecord()) { |
315 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); | 315 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); |
316 usernamePref_.Init(prefs::kGoogleServicesUsername, prefs, this); | 316 usernamePref_.Init(prefs::kGoogleServicesUsername, prefs, this); |
317 | 317 |
318 titlebar_profile_vbox_ = gtk_vbox_new(FALSE, 0); | 318 titlebar_profile_vbox_ = gtk_vbox_new(FALSE, 0); |
319 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_profile_vbox_, | 319 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_profile_vbox_, |
320 FALSE, FALSE, 0); | 320 FALSE, FALSE, 0); |
321 gtk_widget_show_all(titlebar_profile_vbox_); | 321 gtk_widget_show_all(titlebar_profile_vbox_); |
322 | 322 |
323 profile_button_.reset(new ProfileMenuButton( | 323 profile_button_.reset(new ProfileMenuButton( |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 ui::SimpleMenuModel::Delegate* delegate) | 1043 ui::SimpleMenuModel::Delegate* delegate) |
1044 : SimpleMenuModel(delegate) { | 1044 : SimpleMenuModel(delegate) { |
1045 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); | 1045 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); |
1046 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); | 1046 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); |
1047 AddSeparator(); | 1047 AddSeparator(); |
1048 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 1048 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
1049 AddSeparator(); | 1049 AddSeparator(); |
1050 AddCheckItemWithStringId(kShowWindowDecorationsCommand, | 1050 AddCheckItemWithStringId(kShowWindowDecorationsCommand, |
1051 IDS_SHOW_WINDOW_DECORATIONS_MENU); | 1051 IDS_SHOW_WINDOW_DECORATIONS_MENU); |
1052 } | 1052 } |
OLD | NEW |