OLD | NEW |
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 } |
OLD | NEW |