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

Side by Side Diff: chrome/browser/ui/views/frame/system_menu_model_delegate.cc

Issue 2133013002: AcceleratorProvider: Make GetAcceleratorForCommandId const. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix overrides on Mac and Chrome OS. Created 4 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
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/views/frame/system_menu_model_delegate.h" 5 #include "chrome/browser/ui/views/frame/system_menu_model_delegate.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/command_updater.h" 8 #include "chrome/browser/command_updater.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/tab_restore_service_factory.h" 10 #include "chrome/browser/sessions/tab_restore_service_factory.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // TODO(sky): add a way to update menu. 52 // TODO(sky): add a way to update menu.
53 sessions::TabRestoreService* trs = 53 sessions::TabRestoreService* trs =
54 TabRestoreServiceFactory::GetForProfile(browser_->profile()); 54 TabRestoreServiceFactory::GetForProfile(browser_->profile());
55 if (!trs->IsLoaded()) { 55 if (!trs->IsLoaded()) {
56 trs->LoadTabsFromLastSession(); 56 trs->LoadTabsFromLastSession();
57 return false; 57 return false;
58 } 58 }
59 return true; 59 return true;
60 } 60 }
61 61
62 bool SystemMenuModelDelegate::GetAcceleratorForCommandId(int command_id, 62 bool SystemMenuModelDelegate::GetAcceleratorForCommandId(
63 ui::Accelerator* accelerator) { 63 int command_id,
64 ui::Accelerator* accelerator) const {
64 return provider_->GetAcceleratorForCommandId(command_id, accelerator); 65 return provider_->GetAcceleratorForCommandId(command_id, accelerator);
65 } 66 }
66 67
67 bool SystemMenuModelDelegate::IsItemForCommandIdDynamic(int command_id) const { 68 bool SystemMenuModelDelegate::IsItemForCommandIdDynamic(int command_id) const {
68 return command_id == IDC_RESTORE_TAB; 69 return command_id == IDC_RESTORE_TAB;
69 } 70 }
70 71
71 base::string16 SystemMenuModelDelegate::GetLabelForCommandId( 72 base::string16 SystemMenuModelDelegate::GetLabelForCommandId(
72 int command_id) const { 73 int command_id) const {
73 DCHECK_EQ(command_id, IDC_RESTORE_TAB); 74 DCHECK_EQ(command_id, IDC_RESTORE_TAB);
74 75
75 int string_id = IDS_RESTORE_TAB; 76 int string_id = IDS_RESTORE_TAB;
76 if (IsCommandIdEnabled(command_id)) { 77 if (IsCommandIdEnabled(command_id)) {
77 sessions::TabRestoreService* trs = 78 sessions::TabRestoreService* trs =
78 TabRestoreServiceFactory::GetForProfile(browser_->profile()); 79 TabRestoreServiceFactory::GetForProfile(browser_->profile());
79 trs->LoadTabsFromLastSession(); 80 trs->LoadTabsFromLastSession();
80 if (trs && !trs->entries().empty() && 81 if (trs && !trs->entries().empty() &&
81 trs->entries().front()->type == sessions::TabRestoreService::WINDOW) 82 trs->entries().front()->type == sessions::TabRestoreService::WINDOW)
82 string_id = IDS_RESTORE_WINDOW; 83 string_id = IDS_RESTORE_WINDOW;
83 } 84 }
84 return l10n_util::GetStringUTF16(string_id); 85 return l10n_util::GetStringUTF16(string_id);
85 } 86 }
86 87
87 void SystemMenuModelDelegate::ExecuteCommand(int command_id, int event_flags) { 88 void SystemMenuModelDelegate::ExecuteCommand(int command_id, int event_flags) {
88 chrome::ExecuteCommand(browser_, command_id); 89 chrome::ExecuteCommand(browser_, command_id);
89 } 90 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/system_menu_model_delegate.h ('k') | chrome/browser/ui/views/new_task_manager_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698