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

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

Issue 146363002: Linux Aura: Use system title bar is now set by preference, not flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename BrowserView pref registration functions. Created 6 years, 10 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/views/frame/system_menu_model_delegate.h" 5 #include "chrome/browser/ui/views/frame/system_menu_model_delegate.h"
6 6
7 #include "base/prefs/pref_service.h"
7 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/command_updater.h" 9 #include "chrome/browser/command_updater.h"
10 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sessions/tab_restore_service.h" 11 #include "chrome/browser/sessions/tab_restore_service.h"
10 #include "chrome/browser/sessions/tab_restore_service_factory.h" 12 #include "chrome/browser/sessions/tab_restore_service_factory.h"
11 #include "chrome/browser/ui/browser_commands.h" 13 #include "chrome/browser/ui/browser_commands.h"
14 #include "chrome/common/pref_names.h"
12 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
13 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
14 17
15 SystemMenuModelDelegate::SystemMenuModelDelegate( 18 SystemMenuModelDelegate::SystemMenuModelDelegate(
16 ui::AcceleratorProvider* provider, 19 ui::AcceleratorProvider* provider,
17 Browser* browser) 20 Browser* browser)
18 : provider_(provider), 21 : provider_(provider),
19 browser_(browser) { 22 browser_(browser) {
20 } 23 }
21 24
22 SystemMenuModelDelegate::~SystemMenuModelDelegate() { 25 SystemMenuModelDelegate::~SystemMenuModelDelegate() {
23 } 26 }
24 27
25 bool SystemMenuModelDelegate::IsCommandIdChecked(int command_id) const { 28 bool SystemMenuModelDelegate::IsCommandIdChecked(int command_id) const {
26 // TODO(beng): encoding menu. 29 switch (command_id) {
27 // No items in our system menu are check-able. 30 case IDC_USE_SYSTEM_TITLE_BAR: {
28 return false; 31 PrefService* prefs = browser_->profile()->GetPrefs();
32 return !prefs->GetBoolean(prefs::kUseCustomChromeFrame);
33 }
34 default:
35 return false;
36 }
29 } 37 }
30 38
31 bool SystemMenuModelDelegate::IsCommandIdEnabled(int command_id) const { 39 bool SystemMenuModelDelegate::IsCommandIdEnabled(int command_id) const {
32 return chrome::IsCommandEnabled(browser_, command_id); 40 return chrome::IsCommandEnabled(browser_, command_id);
33 } 41 }
34 42
35 bool SystemMenuModelDelegate::GetAcceleratorForCommandId(int command_id, 43 bool SystemMenuModelDelegate::GetAcceleratorForCommandId(int command_id,
36 ui::Accelerator* accelerator) { 44 ui::Accelerator* accelerator) {
37 return provider_->GetAcceleratorForCommandId(command_id, accelerator); 45 return provider_->GetAcceleratorForCommandId(command_id, accelerator);
38 } 46 }
(...skipping 12 matching lines...) Expand all
51 TabRestoreServiceFactory::GetForProfile(browser_->profile()); 59 TabRestoreServiceFactory::GetForProfile(browser_->profile());
52 if (trs && trs->entries().front()->type == TabRestoreService::WINDOW) 60 if (trs && trs->entries().front()->type == TabRestoreService::WINDOW)
53 string_id = IDS_RESTORE_WINDOW; 61 string_id = IDS_RESTORE_WINDOW;
54 } 62 }
55 return l10n_util::GetStringUTF16(string_id); 63 return l10n_util::GetStringUTF16(string_id);
56 } 64 }
57 65
58 void SystemMenuModelDelegate::ExecuteCommand(int command_id, int event_flags) { 66 void SystemMenuModelDelegate::ExecuteCommand(int command_id, int event_flags) {
59 chrome::ExecuteCommand(browser_, command_id); 67 chrome::ExecuteCommand(browser_, command_id);
60 } 68 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/system_menu_model_builder.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698