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

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

Issue 10382229: status_icons: Change StatusTray to use ScopedVector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittest Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/status_icons/status_tray.h" 5 #include "chrome/browser/status_icons/status_tray.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util.h"
10 #include "chrome/browser/status_icons/status_icon.h" 9 #include "chrome/browser/status_icons/status_icon.h"
11 10
12 StatusTray::StatusTray() {
13 }
14
15 StatusTray::~StatusTray() { 11 StatusTray::~StatusTray() {
16 STLDeleteElements(&status_icons_);
17 } 12 }
18 13
19 StatusIcon* StatusTray::CreateStatusIcon() { 14 StatusIcon* StatusTray::CreateStatusIcon() {
20 StatusIcon* icon = CreatePlatformStatusIcon(); 15 StatusIcon* icon = CreatePlatformStatusIcon();
21 if (icon) 16 if (icon)
22 status_icons_.push_back(icon); 17 status_icons_.push_back(icon);
23 return icon; 18 return icon;
24 } 19 }
25 20
26 void StatusTray::RemoveStatusIcon(StatusIcon* icon) { 21 void StatusTray::RemoveStatusIcon(StatusIcon* icon) {
27 StatusIconList::iterator i(std::find(status_icons_.begin(), 22 StatusIcons::iterator i(
28 status_icons_.end(), icon)); 23 std::find(status_icons_.begin(), status_icons_.end(), icon));
24
29 if (i == status_icons_.end()) { 25 if (i == status_icons_.end()) {
30 NOTREACHED(); 26 NOTREACHED();
31 return; 27 return;
32 } 28 }
33 29
34 delete *i;
35 status_icons_.erase(i); 30 status_icons_.erase(i);
36 } 31 }
32
33 StatusTray::StatusTray() {
34 }
OLDNEW
« no previous file with comments | « chrome/browser/status_icons/status_tray.h ('k') | chrome/browser/ui/views/status_icons/status_tray_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698