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

Unified Diff: chrome/browser/status_icons/status_tray.cc

Issue 10156004: status_icons: Fold RemoveAllIcons() into StatusTray dtor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: atwilson review Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/status_icons/status_tray.h ('k') | chrome/browser/status_icons/status_tray_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/status_icons/status_tray.cc
diff --git a/chrome/browser/status_icons/status_tray.cc b/chrome/browser/status_icons/status_tray.cc
index 2a72cd6f43b26fc17204abd117a3b0cbfc046f3f..dccc94f5205c583ef56f5812909d035a2b367bea 100644
--- a/chrome/browser/status_icons/status_tray.cc
+++ b/chrome/browser/status_icons/status_tray.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -13,10 +13,6 @@ StatusTray::StatusTray() {
}
StatusTray::~StatusTray() {
- RemoveAllIcons();
-}
-
-void StatusTray::RemoveAllIcons() {
STLDeleteElements(&status_icons_);
}
@@ -28,11 +24,13 @@ StatusIcon* StatusTray::CreateStatusIcon() {
}
void StatusTray::RemoveStatusIcon(StatusIcon* icon) {
- StatusIconList::iterator iter = std::find(
- status_icons_.begin(), status_icons_.end(), icon);
- if (iter != status_icons_.end()) {
- // Free the StatusIcon from the list.
- delete *iter;
- status_icons_.erase(iter);
+ StatusIconList::iterator i(std::find(status_icons_.begin(),
+ status_icons_.end(), icon));
+ if (i == status_icons_.end()) {
+ NOTREACHED();
+ return;
}
+
+ delete *i;
+ status_icons_.erase(i);
}
« no previous file with comments | « chrome/browser/status_icons/status_tray.h ('k') | chrome/browser/status_icons/status_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698