Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / status_icons / status_icon.cc
blob458fb35c870a252a1db1fc890a5d6341126a0762
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
3 // found in the LICENSE file.
5 #include "chrome/browser/status_icons/status_icon.h"
7 #include "chrome/browser/status_icons/status_icon_observer.h"
9 StatusIcon::StatusIcon() {
12 StatusIcon::~StatusIcon() {
15 void StatusIcon::AddObserver(StatusIconObserver* observer) {
16 observers_.AddObserver(observer);
19 void StatusIcon::RemoveObserver(StatusIconObserver* observer) {
20 observers_.RemoveObserver(observer);
23 bool StatusIcon::HasObservers() const {
24 return observers_.might_have_observers();
27 void StatusIcon::DispatchClickEvent() {
28 FOR_EACH_OBSERVER(StatusIconObserver, observers_, OnStatusIconClicked());
31 #if defined(OS_WIN)
32 void StatusIcon::DispatchBalloonClickEvent() {
33 FOR_EACH_OBSERVER(StatusIconObserver, observers_, OnBalloonClicked());
35 #endif
37 void StatusIcon::SetContextMenu(scoped_ptr<StatusIconMenuModel> menu) {
38 // The UI may been showing a menu for the current model, don't destroy it
39 // until we've notified the UI of the change.
40 scoped_ptr<StatusIconMenuModel> old_menu = context_menu_contents_.Pass();
41 context_menu_contents_ = menu.Pass();
42 UpdatePlatformContextMenu(context_menu_contents_.get());