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

Side by Side 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 unified diff | Download patch
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>
8
9 #include "chrome/browser/status_icons/status_icon.h" 7 #include "chrome/browser/status_icons/status_icon.h"
10 8
11 StatusTray::~StatusTray() { 9 StatusTray::~StatusTray() {
12 } 10 }
13 11
14 StatusIcon* StatusTray::CreateStatusIcon(StatusIconType type, 12 StatusIcon* StatusTray::CreateStatusIcon(StatusIconType type,
15 const gfx::ImageSkia& image, 13 const gfx::ImageSkia& image,
16 const base::string16& tool_tip) { 14 const base::string16& tool_tip) {
17 StatusIcon* icon = CreatePlatformStatusIcon(type, image, tool_tip); 15 auto icon = CreatePlatformStatusIcon(type, image, tool_tip);
18 if (icon) 16 if (!icon)
19 status_icons_.push_back(icon); 17 return nullptr;
20 return icon; 18
19 status_icons_.push_back(std::move(icon));
20 return status_icons_.back().get();
21 } 21 }
22 22
23 void StatusTray::RemoveStatusIcon(StatusIcon* icon) { 23 void StatusTray::RemoveStatusIcon(StatusIcon* icon) {
24 StatusIcons::iterator i( 24 for (auto iter = status_icons_.begin(); iter != status_icons_.end(); ++iter) {
25 std::find(status_icons_.begin(), status_icons_.end(), icon)); 25 if (iter->get() == icon) {
26 26 status_icons_.erase(iter);
27 if (i == status_icons_.end()) { 27 return;
28 NOTREACHED(); 28 }
29 return;
30 } 29 }
31 30 NOTREACHED();
32 status_icons_.erase(i);
33 } 31 }
34 32
35 StatusTray::StatusTray() { 33 StatusTray::StatusTray() {
36 } 34 }
OLDNEW
« 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