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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 app_mode_title_ = gtk_label_new(NULL); | 396 app_mode_title_ = gtk_label_new(NULL); |
397 gtk_label_set_ellipsize(GTK_LABEL(app_mode_title_), PANGO_ELLIPSIZE_END); | 397 gtk_label_set_ellipsize(GTK_LABEL(app_mode_title_), PANGO_ELLIPSIZE_END); |
398 gtk_misc_set_alignment(GTK_MISC(app_mode_title_), 0.0, 0.5); | 398 gtk_misc_set_alignment(GTK_MISC(app_mode_title_), 0.0, 0.5); |
399 gtk_box_pack_start(GTK_BOX(app_mode_hbox), app_mode_title_, TRUE, TRUE, | 399 gtk_box_pack_start(GTK_BOX(app_mode_hbox), app_mode_title_, TRUE, TRUE, |
400 0); | 400 0); |
401 | 401 |
402 // Register with the theme provider to set the |app_mode_title_| label | 402 // Register with the theme provider to set the |app_mode_title_| label |
403 // color. | 403 // color. |
404 theme_service_ = GtkThemeService::GetFrom( | 404 theme_service_ = GtkThemeService::GetFrom( |
405 browser_window_->browser()->profile()); | 405 browser_window_->browser()->profile()); |
406 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 406 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
407 Source<ThemeService>(theme_service_)); | 407 Source<ThemeService>(theme_service_)); |
408 theme_service_->InitThemesFor(this); | 408 theme_service_->InitThemesFor(this); |
409 UpdateTitleAndIcon(); | 409 UpdateTitleAndIcon(); |
410 } | 410 } |
411 | 411 |
412 gtk_widget_show_all(container_); | 412 gtk_widget_show_all(container_); |
413 | 413 |
414 ui::ActiveWindowWatcherX::AddObserver(this); | 414 ui::ActiveWindowWatcherX::AddObserver(this); |
415 } | 415 } |
416 | 416 |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 bool BrowserTitlebar::GetAcceleratorForCommandId( | 935 bool BrowserTitlebar::GetAcceleratorForCommandId( |
936 int command_id, ui::Accelerator* accelerator) { | 936 int command_id, ui::Accelerator* accelerator) { |
937 const ui::AcceleratorGtk* accelerator_gtk = | 937 const ui::AcceleratorGtk* accelerator_gtk = |
938 AcceleratorsGtk::GetInstance()->GetPrimaryAcceleratorForCommand( | 938 AcceleratorsGtk::GetInstance()->GetPrimaryAcceleratorForCommand( |
939 command_id); | 939 command_id); |
940 if (accelerator_gtk) | 940 if (accelerator_gtk) |
941 *accelerator = *accelerator_gtk; | 941 *accelerator = *accelerator_gtk; |
942 return accelerator_gtk; | 942 return accelerator_gtk; |
943 } | 943 } |
944 | 944 |
945 void BrowserTitlebar::Observe(NotificationType type, | 945 void BrowserTitlebar::Observe(int type, |
946 const NotificationSource& source, | 946 const NotificationSource& source, |
947 const NotificationDetails& details) { | 947 const NotificationDetails& details) { |
948 switch (type.value) { | 948 switch (type) { |
949 case NotificationType::BROWSER_THEME_CHANGED: | 949 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: |
950 UpdateTextColor(); | 950 UpdateTextColor(); |
951 break; | 951 break; |
952 | 952 |
953 case NotificationType::PREF_CHANGED: { | 953 case chrome::PREF_CHANGED: { |
954 std::string* name = Details<std::string>(details).ptr(); | 954 std::string* name = Details<std::string>(details).ptr(); |
955 if (prefs::kGoogleServicesUsername == *name) | 955 if (prefs::kGoogleServicesUsername == *name) |
956 profile_button_->UpdateText(); | 956 profile_button_->UpdateText(); |
957 break; | 957 break; |
958 } | 958 } |
959 | 959 |
960 default: | 960 default: |
961 NOTREACHED(); | 961 NOTREACHED(); |
962 } | 962 } |
963 } | 963 } |
(...skipping 79 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 |