Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / command_observer_bridge.mm
blobaa01368a59b7d7efd7798f337c5c699dd8809362
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import "chrome/browser/ui/cocoa/command_observer_bridge.h"
6 #include "chrome/browser/command_updater.h"
8 #include "base/logging.h"
10 CommandObserverBridge::CommandObserverBridge(
11     id<CommandObserverProtocol> observer, CommandUpdater* commands)
12         : observer_(observer), commands_(commands) {
13   DCHECK(observer_ && commands_);
16 CommandObserverBridge::~CommandObserverBridge() {
17   // Unregister the notifications
18   commands_->RemoveCommandObserver(this);
21 void CommandObserverBridge::ObserveCommand(int command) {
22   commands_->AddCommandObserver(command, this);
25 void CommandObserverBridge::EnabledStateChangedForCommand(int command,
26                                                           bool enabled) {
27   [observer_ enabledStateChangedForCommand:command
28                                    enabled:enabled ? YES : NO];