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

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: fix unittest 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
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..9f5f4994b255a7949e9cee404f4f3a026696609a 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,9 @@ 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));
+ DCHECK(i != status_icons_.end());
Andrew T Wilson (Slow) 2012/04/20 19:13:09 I think I'd prefer this to read: if (i == status_i
tfarina 2012/04/20 19:24:13 Done.
+ delete *i;
+ status_icons_.erase(i);
}

Powered by Google App Engine
This is Rietveld 408576698