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 StatusIcon()9StatusIcon::StatusIcon() 10 { 11 } 12 ~StatusIcon()13StatusIcon::~StatusIcon() { 14 } 15 AddObserver(Observer * observer)16void StatusIcon::AddObserver(Observer* observer) { 17 observers_.AddObserver(observer); 18 } 19 RemoveObserver(Observer * observer)20void StatusIcon::RemoveObserver(Observer* observer) { 21 observers_.RemoveObserver(observer); 22 } 23 HasObservers()24bool StatusIcon::HasObservers() { 25 return observers_.size() > 0; 26 } 27 DispatchClickEvent()28void StatusIcon::DispatchClickEvent() { 29 FOR_EACH_OBSERVER(Observer, observers_, OnClicked()); 30 } 31 SetContextMenu(ui::MenuModel * menu)32void StatusIcon::SetContextMenu(ui::MenuModel* menu) { 33 context_menu_contents_.reset(menu); 34 UpdatePlatformContextMenu(menu); 35 } 36