OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
15 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
16 #include "base/string_piece.h" | 16 #include "base/string_piece.h" |
17 #include "base/string_tokenizer.h" | 17 #include "base/string_tokenizer.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "chrome/app/chrome_command_ids.h" | 19 #include "chrome/app/chrome_command_ids.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/managed_mode.h" | 21 #include "chrome/browser/managed_mode.h" |
22 #include "chrome/browser/prefs/pref_service.h" | 22 #include "chrome/browser/prefs/pref_service.h" |
23 #include "chrome/browser/profiles/avatar_menu_model.h" | 23 #include "chrome/browser/profiles/avatar_menu_model.h" |
24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/profiles/profile_info_cache.h" | 25 #include "chrome/browser/profiles/profile_info_cache.h" |
26 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
27 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
28 #include "chrome/browser/ui/browser_commands.h" | 28 #include "chrome/browser/ui/browser_commands.h" |
| 29 #include "chrome/browser/ui/browser_tabstrip.h" |
29 #include "chrome/browser/ui/gtk/accelerators_gtk.h" | 30 #include "chrome/browser/ui/gtk/accelerators_gtk.h" |
30 #include "chrome/browser/ui/gtk/avatar_menu_button_gtk.h" | 31 #include "chrome/browser/ui/gtk/avatar_menu_button_gtk.h" |
31 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 32 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
32 #include "chrome/browser/ui/gtk/custom_button.h" | 33 #include "chrome/browser/ui/gtk/custom_button.h" |
33 #if defined(USE_GCONF) | 34 #if defined(USE_GCONF) |
34 #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h" | 35 #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h" |
35 #endif | 36 #endif |
36 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 37 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
37 #include "chrome/browser/ui/gtk/gtk_util.h" | 38 #include "chrome/browser/ui/gtk/gtk_util.h" |
38 #include "chrome/browser/ui/gtk/menu_gtk.h" | 39 #include "chrome/browser/ui/gtk/menu_gtk.h" |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 | 944 |
944 bool BrowserTitlebar::IsCommandIdChecked(int command_id) const { | 945 bool BrowserTitlebar::IsCommandIdChecked(int command_id) const { |
945 if (command_id == kShowWindowDecorationsCommand) { | 946 if (command_id == kShowWindowDecorationsCommand) { |
946 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); | 947 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); |
947 return !prefs->GetBoolean(prefs::kUseCustomChromeFrame); | 948 return !prefs->GetBoolean(prefs::kUseCustomChromeFrame); |
948 } | 949 } |
949 | 950 |
950 EncodingMenuController controller; | 951 EncodingMenuController controller; |
951 if (controller.DoesCommandBelongToEncodingMenu(command_id)) { | 952 if (controller.DoesCommandBelongToEncodingMenu(command_id)) { |
952 WebContents* web_contents = | 953 WebContents* web_contents = |
953 browser_window_->browser()->GetActiveWebContents(); | 954 chrome::GetActiveWebContents(browser_window_->browser()); |
954 if (web_contents) { | 955 if (web_contents) { |
955 return controller.IsItemChecked(browser_window_->browser()->profile(), | 956 return controller.IsItemChecked(browser_window_->browser()->profile(), |
956 web_contents->GetEncoding(), | 957 web_contents->GetEncoding(), |
957 command_id); | 958 command_id); |
958 } | 959 } |
959 return false; | 960 return false; |
960 } | 961 } |
961 | 962 |
962 NOTREACHED(); | 963 NOTREACHED(); |
963 return false; | 964 return false; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 ui::SimpleMenuModel::Delegate* delegate) | 1054 ui::SimpleMenuModel::Delegate* delegate) |
1054 : SimpleMenuModel(delegate) { | 1055 : SimpleMenuModel(delegate) { |
1055 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); | 1056 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); |
1056 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); | 1057 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); |
1057 AddSeparator(); | 1058 AddSeparator(); |
1058 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 1059 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
1059 AddSeparator(); | 1060 AddSeparator(); |
1060 AddCheckItemWithStringId(kShowWindowDecorationsCommand, | 1061 AddCheckItemWithStringId(kShowWindowDecorationsCommand, |
1061 IDS_SHOW_WINDOW_DECORATIONS_MENU); | 1062 IDS_SHOW_WINDOW_DECORATIONS_MENU); |
1062 } | 1063 } |
OLD | NEW |