| 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 17 matching lines...) Expand all Loading... |
| 28 #endif | 28 #endif |
| 29 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 29 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 30 #include "chrome/browser/ui/gtk/gtk_util.h" | 30 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 31 #include "chrome/browser/ui/gtk/menu_gtk.h" | 31 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 32 #include "chrome/browser/ui/gtk/nine_box.h" | 32 #include "chrome/browser/ui/gtk/nine_box.h" |
| 33 #include "chrome/browser/ui/gtk/profile_menu_button.h" | 33 #include "chrome/browser/ui/gtk/profile_menu_button.h" |
| 34 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" | 34 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
| 35 #include "chrome/browser/ui/gtk/unity_service.h" | 35 #include "chrome/browser/ui/gtk/unity_service.h" |
| 36 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 36 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
| 37 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 37 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 38 #include "chrome/common/chrome_notification_types.h" |
| 38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| 40 #include "content/browser/tab_contents/tab_contents.h" | 41 #include "content/browser/tab_contents/tab_contents.h" |
| 41 #include "content/common/notification_service.h" | 42 #include "content/common/notification_service.h" |
| 42 #include "grit/generated_resources.h" | 43 #include "grit/generated_resources.h" |
| 43 #include "grit/theme_resources.h" | 44 #include "grit/theme_resources.h" |
| 44 #include "grit/theme_resources_standard.h" | 45 #include "grit/theme_resources_standard.h" |
| 45 #include "grit/ui_resources.h" | 46 #include "grit/ui_resources.h" |
| 46 #include "ui/base/l10n/l10n_util.h" | 47 #include "ui/base/l10n/l10n_util.h" |
| 47 #include "ui/base/resource/resource_bundle.h" | 48 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 app_mode_title_ = gtk_label_new(NULL); | 397 app_mode_title_ = gtk_label_new(NULL); |
| 397 gtk_label_set_ellipsize(GTK_LABEL(app_mode_title_), PANGO_ELLIPSIZE_END); | 398 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); | 399 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, | 400 gtk_box_pack_start(GTK_BOX(app_mode_hbox), app_mode_title_, TRUE, TRUE, |
| 400 0); | 401 0); |
| 401 | 402 |
| 402 // Register with the theme provider to set the |app_mode_title_| label | 403 // Register with the theme provider to set the |app_mode_title_| label |
| 403 // color. | 404 // color. |
| 404 theme_service_ = GtkThemeService::GetFrom( | 405 theme_service_ = GtkThemeService::GetFrom( |
| 405 browser_window_->browser()->profile()); | 406 browser_window_->browser()->profile()); |
| 406 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 407 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 407 Source<ThemeService>(theme_service_)); | 408 Source<ThemeService>(theme_service_)); |
| 408 theme_service_->InitThemesFor(this); | 409 theme_service_->InitThemesFor(this); |
| 409 UpdateTitleAndIcon(); | 410 UpdateTitleAndIcon(); |
| 410 } | 411 } |
| 411 | 412 |
| 412 gtk_widget_show_all(container_); | 413 gtk_widget_show_all(container_); |
| 413 | 414 |
| 414 ui::ActiveWindowWatcherX::AddObserver(this); | 415 ui::ActiveWindowWatcherX::AddObserver(this); |
| 415 } | 416 } |
| 416 | 417 |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 bool BrowserTitlebar::GetAcceleratorForCommandId( | 936 bool BrowserTitlebar::GetAcceleratorForCommandId( |
| 936 int command_id, ui::Accelerator* accelerator) { | 937 int command_id, ui::Accelerator* accelerator) { |
| 937 const ui::AcceleratorGtk* accelerator_gtk = | 938 const ui::AcceleratorGtk* accelerator_gtk = |
| 938 AcceleratorsGtk::GetInstance()->GetPrimaryAcceleratorForCommand( | 939 AcceleratorsGtk::GetInstance()->GetPrimaryAcceleratorForCommand( |
| 939 command_id); | 940 command_id); |
| 940 if (accelerator_gtk) | 941 if (accelerator_gtk) |
| 941 *accelerator = *accelerator_gtk; | 942 *accelerator = *accelerator_gtk; |
| 942 return accelerator_gtk; | 943 return accelerator_gtk; |
| 943 } | 944 } |
| 944 | 945 |
| 945 void BrowserTitlebar::Observe(NotificationType type, | 946 void BrowserTitlebar::Observe(int type, |
| 946 const NotificationSource& source, | 947 const NotificationSource& source, |
| 947 const NotificationDetails& details) { | 948 const NotificationDetails& details) { |
| 948 switch (type.value) { | 949 switch (type) { |
| 949 case NotificationType::BROWSER_THEME_CHANGED: | 950 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: |
| 950 UpdateTextColor(); | 951 UpdateTextColor(); |
| 951 break; | 952 break; |
| 952 | 953 |
| 953 case NotificationType::PREF_CHANGED: { | 954 case chrome::NOTIFICATION_PREF_CHANGED: { |
| 954 std::string* name = Details<std::string>(details).ptr(); | 955 std::string* name = Details<std::string>(details).ptr(); |
| 955 if (prefs::kGoogleServicesUsername == *name) | 956 if (prefs::kGoogleServicesUsername == *name) |
| 956 profile_button_->UpdateText(); | 957 profile_button_->UpdateText(); |
| 957 break; | 958 break; |
| 958 } | 959 } |
| 959 | 960 |
| 960 default: | 961 default: |
| 961 NOTREACHED(); | 962 NOTREACHED(); |
| 962 } | 963 } |
| 963 } | 964 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 ui::SimpleMenuModel::Delegate* delegate) | 1044 ui::SimpleMenuModel::Delegate* delegate) |
| 1044 : SimpleMenuModel(delegate) { | 1045 : SimpleMenuModel(delegate) { |
| 1045 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); | 1046 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); |
| 1046 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); | 1047 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); |
| 1047 AddSeparator(); | 1048 AddSeparator(); |
| 1048 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 1049 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
| 1049 AddSeparator(); | 1050 AddSeparator(); |
| 1050 AddCheckItemWithStringId(kShowWindowDecorationsCommand, | 1051 AddCheckItemWithStringId(kShowWindowDecorationsCommand, |
| 1051 IDS_SHOW_WINDOW_DECORATIONS_MENU); | 1052 IDS_SHOW_WINDOW_DECORATIONS_MENU); |
| 1052 } | 1053 } |
| OLD | NEW |