Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: chrome/browser/status_icons/status_tray.cc

Issue 661454: Initial implementation of status tray functionality (mac-only, currently). (Closed)
Patch Set: more changes per review feedback Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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_tray.h"
6
7 #include "base/stl_util-inl.h"
8 #include "chrome/browser/status_icons/status_icon.h"
9
10 StatusTray::StatusTray(StatusIconFactory* factory)
11 : factory_(factory) {
12 }
13
14 StatusTray::~StatusTray() {
15 // Walk any active status icons and delete them.
16 STLDeleteContainerPairSecondPointers(status_icons_.begin(),
17 status_icons_.end());
18 }
19
20 StatusIcon* StatusTray::GetStatusIcon(const string16& identifier) {
21 StatusIconMap::const_iterator iter = status_icons_.find(identifier);
22 if (iter != status_icons_.end())
23 return iter->second;
24
25 // No existing StatusIcon, create a new one.
26 StatusIcon* icon = factory_->CreateIcon();
27 if (icon)
28 status_icons_[identifier] = icon;
29 return icon;
30 }
31
32 void StatusTray::RemoveStatusIcon(const string16& identifier) {
33 StatusIconMap::iterator iter = status_icons_.find(identifier);
34 if (iter != status_icons_.end()) {
35 // Free the StatusIcon from the map (can't put scoped_ptr in a map, so we
36 // have to do it manually).
37 delete iter->second;
38 status_icons_.erase(iter);
39 }
40 }
OLDNEW
« no previous file with comments | « chrome/browser/status_icons/status_tray.h ('k') | chrome/browser/status_icons/status_tray_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698