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> |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 if (browser_command_line.HasSwitch(switches::kMultiProfiles) && | 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( |
| 324 browser_window_->browser()->profile())); |
324 gtk_box_pack_start(GTK_BOX(titlebar_profile_vbox_), | 325 gtk_box_pack_start(GTK_BOX(titlebar_profile_vbox_), |
325 profile_button_->widget(), FALSE, FALSE, 0); | 326 profile_button_->widget(), FALSE, FALSE, 0); |
326 profile_button_->UpdateText(browser_window_->browser()->profile()); | 327 profile_button_->UpdateText(); |
327 } | 328 } |
328 | 329 |
329 if (browser_window_->browser()->profile()->IsOffTheRecord() && | 330 if (browser_window_->browser()->profile()->IsOffTheRecord() && |
330 browser_window_->browser()->is_type_tabbed()) { | 331 browser_window_->browser()->is_type_tabbed()) { |
331 titlebar_right_spy_frame_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 332 titlebar_right_spy_frame_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
332 gtk_widget_set_no_show_all(titlebar_right_spy_frame_, TRUE); | 333 gtk_widget_set_no_show_all(titlebar_right_spy_frame_, TRUE); |
333 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_right_spy_frame_), 0, | 334 gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_right_spy_frame_), 0, |
334 kOTRBottomSpacing, kOTRSideSpacing, kOTRSideSpacing); | 335 kOTRBottomSpacing, kOTRSideSpacing, kOTRSideSpacing); |
335 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_right_spy_frame_, | 336 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_right_spy_frame_, |
336 FALSE, FALSE, 0); | 337 FALSE, FALSE, 0); |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 const NotificationSource& source, | 946 const NotificationSource& source, |
946 const NotificationDetails& details) { | 947 const NotificationDetails& details) { |
947 switch (type.value) { | 948 switch (type.value) { |
948 case NotificationType::BROWSER_THEME_CHANGED: | 949 case NotificationType::BROWSER_THEME_CHANGED: |
949 UpdateTextColor(); | 950 UpdateTextColor(); |
950 break; | 951 break; |
951 | 952 |
952 case NotificationType::PREF_CHANGED: { | 953 case NotificationType::PREF_CHANGED: { |
953 std::string* name = Details<std::string>(details).ptr(); | 954 std::string* name = Details<std::string>(details).ptr(); |
954 if (prefs::kGoogleServicesUsername == *name) | 955 if (prefs::kGoogleServicesUsername == *name) |
955 profile_button_->UpdateText(browser_window_->browser()->profile()); | 956 profile_button_->UpdateText(); |
956 break; | 957 break; |
957 } | 958 } |
958 | 959 |
959 default: | 960 default: |
960 NOTREACHED(); | 961 NOTREACHED(); |
961 } | 962 } |
962 } | 963 } |
963 | 964 |
964 void BrowserTitlebar::ActiveWindowChanged(GdkWindow* active_window) { | 965 void BrowserTitlebar::ActiveWindowChanged(GdkWindow* active_window) { |
965 // Can be called during shutdown; BrowserWindowGtk will set our |window_| | 966 // Can be called during shutdown; BrowserWindowGtk will set our |window_| |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 ui::SimpleMenuModel::Delegate* delegate) | 1043 ui::SimpleMenuModel::Delegate* delegate) |
1043 : SimpleMenuModel(delegate) { | 1044 : SimpleMenuModel(delegate) { |
1044 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); | 1045 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); |
1045 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); | 1046 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); |
1046 AddSeparator(); | 1047 AddSeparator(); |
1047 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 1048 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
1048 AddSeparator(); | 1049 AddSeparator(); |
1049 AddCheckItemWithStringId(kShowWindowDecorationsCommand, | 1050 AddCheckItemWithStringId(kShowWindowDecorationsCommand, |
1050 IDS_SHOW_WINDOW_DECORATIONS_MENU); | 1051 IDS_SHOW_WINDOW_DECORATIONS_MENU); |
1051 } | 1052 } |
OLD | NEW |