Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: chrome/browser/ui/gtk/browser_titlebar.cc

Issue 10677009: Move command handling and updating off Browser and onto a helper object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 } 931 }
932 932
933 context_menu_->PopupAsContext(gfx::Point(event->x_root, event->y_root), 933 context_menu_->PopupAsContext(gfx::Point(event->x_root, event->y_root),
934 event->time); 934 event->time);
935 } 935 }
936 936
937 bool BrowserTitlebar::IsCommandIdEnabled(int command_id) const { 937 bool BrowserTitlebar::IsCommandIdEnabled(int command_id) const {
938 if (command_id == kShowWindowDecorationsCommand) 938 if (command_id == kShowWindowDecorationsCommand)
939 return true; 939 return true;
940 940
941 return browser_window_->browser()->command_updater()-> 941 return chrome::IsCommandEnabled(browser_window_->browser(), command_id);
942 IsCommandEnabled(command_id);
943 } 942 }
944 943
945 bool BrowserTitlebar::IsCommandIdChecked(int command_id) const { 944 bool BrowserTitlebar::IsCommandIdChecked(int command_id) const {
946 if (command_id == kShowWindowDecorationsCommand) { 945 if (command_id == kShowWindowDecorationsCommand) {
947 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); 946 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs();
948 return !prefs->GetBoolean(prefs::kUseCustomChromeFrame); 947 return !prefs->GetBoolean(prefs::kUseCustomChromeFrame);
949 } 948 }
950 949
951 EncodingMenuController controller; 950 EncodingMenuController controller;
952 if (controller.DoesCommandBelongToEncodingMenu(command_id)) { 951 if (controller.DoesCommandBelongToEncodingMenu(command_id)) {
(...skipping 12 matching lines...) Expand all
965 } 964 }
966 965
967 void BrowserTitlebar::ExecuteCommand(int command_id) { 966 void BrowserTitlebar::ExecuteCommand(int command_id) {
968 if (command_id == kShowWindowDecorationsCommand) { 967 if (command_id == kShowWindowDecorationsCommand) {
969 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); 968 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs();
970 prefs->SetBoolean(prefs::kUseCustomChromeFrame, 969 prefs->SetBoolean(prefs::kUseCustomChromeFrame,
971 !prefs->GetBoolean(prefs::kUseCustomChromeFrame)); 970 !prefs->GetBoolean(prefs::kUseCustomChromeFrame));
972 return; 971 return;
973 } 972 }
974 973
975 browser_window_->browser()->ExecuteCommand(command_id); 974 chrome::ExecuteCommand(browser_window_->browser(), command_id);
976 } 975 }
977 976
978 bool BrowserTitlebar::GetAcceleratorForCommandId( 977 bool BrowserTitlebar::GetAcceleratorForCommandId(
979 int command_id, ui::Accelerator* accelerator) { 978 int command_id, ui::Accelerator* accelerator) {
980 const ui::AcceleratorGtk* accelerator_gtk = 979 const ui::AcceleratorGtk* accelerator_gtk =
981 AcceleratorsGtk::GetInstance()->GetPrimaryAcceleratorForCommand( 980 AcceleratorsGtk::GetInstance()->GetPrimaryAcceleratorForCommand(
982 command_id); 981 command_id);
983 if (accelerator_gtk) 982 if (accelerator_gtk)
984 *accelerator = *accelerator_gtk; 983 *accelerator = *accelerator_gtk;
985 return accelerator_gtk; 984 return accelerator_gtk;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 ui::SimpleMenuModel::Delegate* delegate) 1053 ui::SimpleMenuModel::Delegate* delegate)
1055 : SimpleMenuModel(delegate) { 1054 : SimpleMenuModel(delegate) {
1056 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); 1055 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB);
1057 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); 1056 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB);
1058 AddSeparator(); 1057 AddSeparator();
1059 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); 1058 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER);
1060 AddSeparator(); 1059 AddSeparator();
1061 AddCheckItemWithStringId(kShowWindowDecorationsCommand, 1060 AddCheckItemWithStringId(kShowWindowDecorationsCommand,
1062 IDS_SHOW_WINDOW_DECORATIONS_MENU); 1061 IDS_SHOW_WINDOW_DECORATIONS_MENU);
1063 } 1062 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/back_forward_button_gtk.cc ('k') | chrome/browser/ui/gtk/browser_toolbar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698