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

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

Issue 2767893002: Remove ScopedVector from chrome/browser/. (Closed)
Patch Set: Address comments from zea@ Created 3 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 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 0cfe61814aec681e60e2f9096f50b44bea72e0d1..bc68e9a25eaaae15e1424b85238c5e3c710bbf47 100644
--- a/chrome/browser/status_icons/status_tray.cc
+++ b/chrome/browser/status_icons/status_tray.cc
@@ -4,8 +4,6 @@
#include "chrome/browser/status_icons/status_tray.h"
-#include <algorithm>
-
#include "chrome/browser/status_icons/status_icon.h"
StatusTray::~StatusTray() {
@@ -14,22 +12,22 @@ StatusTray::~StatusTray() {
StatusIcon* StatusTray::CreateStatusIcon(StatusIconType type,
const gfx::ImageSkia& image,
const base::string16& tool_tip) {
- StatusIcon* icon = CreatePlatformStatusIcon(type, image, tool_tip);
- if (icon)
- status_icons_.push_back(icon);
- return icon;
+ auto icon = CreatePlatformStatusIcon(type, image, tool_tip);
+ if (!icon)
+ return nullptr;
+
+ status_icons_.push_back(std::move(icon));
+ return status_icons_.back().get();
}
void StatusTray::RemoveStatusIcon(StatusIcon* icon) {
- StatusIcons::iterator i(
- std::find(status_icons_.begin(), status_icons_.end(), icon));
-
- if (i == status_icons_.end()) {
- NOTREACHED();
- return;
+ for (auto iter = status_icons_.begin(); iter != status_icons_.end(); ++iter) {
+ if (iter->get() == icon) {
+ status_icons_.erase(iter);
+ return;
+ }
}
-
- status_icons_.erase(i);
+ NOTREACHED();
}
StatusTray::StatusTray() {
« 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