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

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

Issue 9479008: Re-factor location bar/toolbar code to get rid of the browser dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: call right overloaded method Created 8 years, 9 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
« no previous file with comments | « chrome/browser/command_updater.h ('k') | chrome/browser/command_updater_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 if (command == commands_.end()) 34 if (command == commands_.end())
35 return false; 35 return false;
36 return command->second->enabled; 36 return command->second->enabled;
37 } 37 }
38 38
39 bool CommandUpdater::SupportsCommand(int id) const { 39 bool CommandUpdater::SupportsCommand(int id) const {
40 return commands_.find(id) != commands_.end(); 40 return commands_.find(id) != commands_.end();
41 } 41 }
42 42
43 void CommandUpdater::ExecuteCommand(int id) { 43 void CommandUpdater::ExecuteCommand(int id) {
44 ExecuteCommandWithDisposition(id, CURRENT_TAB);
45 }
46
47 void CommandUpdater::ExecuteCommandWithDisposition(
48 int id,
49 WindowOpenDisposition disposition) {
44 if (IsCommandEnabled(id)) 50 if (IsCommandEnabled(id))
45 delegate_->ExecuteCommand(id); 51 delegate_->ExecuteCommandWithDisposition(id, disposition);
46 } 52 }
47 53
48 CommandUpdater::CommandObserver::~CommandObserver() { 54 CommandUpdater::CommandObserver::~CommandObserver() {
49 } 55 }
50 56
51 void CommandUpdater::UpdateCommandEnabled(int id, bool enabled) { 57 void CommandUpdater::UpdateCommandEnabled(int id, bool enabled) {
52 Command* command = GetCommand(id, true); 58 Command* command = GetCommand(id, true);
53 if (command->enabled == enabled) 59 if (command->enabled == enabled)
54 return; // Nothing to do. 60 return; // Nothing to do.
55 command->enabled = enabled; 61 command->enabled = enabled;
(...skipping 21 matching lines...) Expand all
77 83
78 void CommandUpdater::RemoveCommandObserver(CommandObserver* observer) { 84 void CommandUpdater::RemoveCommandObserver(CommandObserver* observer) {
79 for (CommandMap::const_iterator it = commands_.begin(); 85 for (CommandMap::const_iterator it = commands_.begin();
80 it != commands_.end(); 86 it != commands_.end();
81 ++it) { 87 ++it) {
82 Command* command = it->second; 88 Command* command = it->second;
83 if (command) 89 if (command)
84 command->observers.RemoveObserver(observer); 90 command->observers.RemoveObserver(observer);
85 } 91 }
86 } 92 }
OLDNEW
« no previous file with comments | « chrome/browser/command_updater.h ('k') | chrome/browser/command_updater_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698