diff options
author | atwilson@google.com <atwilson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 21:29:05 +0000 |
---|---|---|
committer | atwilson@google.com <atwilson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 21:29:05 +0000 |
commit | a24642a800c1712eeaa791f0fb0ed1527885c6fb (patch) | |
tree | 925671bf6414abcc8da68cd48a6085fa0007dd6b /chrome/browser/status_icons/status_icon.cc | |
parent | 45e9bcaa8bd6ff0eb2bf61d7100b1faacd2ccef4 (diff) | |
download | chromium_src-a24642a800c1712eeaa791f0fb0ed1527885c6fb.zip chromium_src-a24642a800c1712eeaa791f0fb0ed1527885c6fb.tar.gz chromium_src-a24642a800c1712eeaa791f0fb0ed1527885c6fb.tar.bz2 |
Implement status icons on windows.
Refactor existing status icon code to allow platform-specific StatusTray implementation to
track common state for all status icons.
BUG=37375
TEST=new unit tests
Review URL: http://codereview.chromium.org/1136005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42538 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/status_icons/status_icon.cc')
-rw-r--r-- | chrome/browser/status_icons/status_icon.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/status_icons/status_icon.cc b/chrome/browser/status_icons/status_icon.cc new file mode 100644 index 0000000..85fd175 --- /dev/null +++ b/chrome/browser/status_icons/status_icon.cc @@ -0,0 +1,30 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <algorithm> + +#include "chrome/browser/status_icons/status_icon.h" + +void StatusIcon::AddObserver(StatusIconObserver* observer) { + observers_.push_back(observer); +} + +void StatusIcon::RemoveObserver(StatusIconObserver* observer) { + std::vector<StatusIconObserver*>::iterator iter = + std::find(observers_.begin(), observers_.end(), observer); + if (iter != observers_.end()) + observers_.erase(iter); +} + +void StatusIcon::DispatchClickEvent() { + // Walk observers, call callback for each one. + for (std::vector<StatusIconObserver*>::const_iterator iter = + observers_.begin(); + iter != observers_.end(); + ++iter) { + StatusIconObserver* observer = *iter; + observer->OnClicked(); + } +} + |