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

Side by Side Diff: chrome/browser/command_updater.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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/command_updater.h" 5 #include "chrome/browser/command_updater.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 bool CommandUpdater::IsCommandEnabled(int id) const { 36 bool CommandUpdater::IsCommandEnabled(int id) const {
37 const CommandMap::const_iterator command(commands_.find(id)); 37 const CommandMap::const_iterator command(commands_.find(id));
38 if (command == commands_.end()) 38 if (command == commands_.end())
39 return false; 39 return false;
40 return command->second->enabled; 40 return command->second->enabled;
41 } 41 }
42 42
43 bool CommandUpdater::ExecuteCommand(int id) { 43 bool CommandUpdater::ExecuteCommand(int id) {
44 return ExecuteCommandWithDisposition(id, CURRENT_TAB); 44 return ExecuteCommandWithDisposition(id, WindowOpenDisposition::CURRENT_TAB);
45 } 45 }
46 46
47 bool CommandUpdater::ExecuteCommandWithDisposition( 47 bool CommandUpdater::ExecuteCommandWithDisposition(
48 int id, 48 int id,
49 WindowOpenDisposition disposition) { 49 WindowOpenDisposition disposition) {
50 if (SupportsCommand(id) && IsCommandEnabled(id)) { 50 if (SupportsCommand(id) && IsCommandEnabled(id)) {
51 delegate_->ExecuteCommandWithDisposition(id, disposition); 51 delegate_->ExecuteCommandWithDisposition(id, disposition);
52 return true; 52 return true;
53 } 53 }
54 return false; 54 return false;
(...skipping 28 matching lines...) Expand all
83 83
84 CommandUpdater::Command* CommandUpdater::GetCommand(int id, bool create) { 84 CommandUpdater::Command* CommandUpdater::GetCommand(int id, bool create) {
85 bool supported = SupportsCommand(id); 85 bool supported = SupportsCommand(id);
86 if (supported) 86 if (supported)
87 return commands_[id]; 87 return commands_[id];
88 DCHECK(create); 88 DCHECK(create);
89 Command* command = new Command; 89 Command* command = new Command;
90 commands_[id] = command; 90 commands_[id] = command;
91 return command; 91 return command;
92 } 92 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/device_local_account_browsertest.cc ('k') | chrome/browser/crash_recovery_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698