Home | History | Annotate | Download | only in status_icons
      1 // Copyright (c) 2010 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.
      4 
      5 #include "chrome/browser/status_icons/status_icon.h"
      6 
      7 #include "ui/base/models/menu_model.h"
      8 
      9 StatusIcon::StatusIcon()
     10 {
     11 }
     12 
     13 StatusIcon::~StatusIcon() {
     14 }
     15 
     16 void StatusIcon::AddObserver(Observer* observer) {
     17   observers_.AddObserver(observer);
     18 }
     19 
     20 void StatusIcon::RemoveObserver(Observer* observer) {
     21   observers_.RemoveObserver(observer);
     22 }
     23 
     24 bool StatusIcon::HasObservers() {
     25   return observers_.size() > 0;
     26 }
     27 
     28 void StatusIcon::DispatchClickEvent() {
     29   FOR_EACH_OBSERVER(Observer, observers_, OnClicked());
     30 }
     31 
     32 void StatusIcon::SetContextMenu(ui::MenuModel* menu) {
     33   context_menu_contents_.reset(menu);
     34   UpdatePlatformContextMenu(menu);
     35 }
     36