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

Side by Side Diff: extensions/browser/app_window/app_window_registry.cc

Issue 2950263003: Use ContainsValue() instead of std::find() in extensions/ (Closed)
Patch Set: Rebase patch. Created 3 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/app_window/app_window_registry.h" 5 #include "extensions/browser/app_window/app_window_registry.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/stl_util.h"
10 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h" 12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "content/public/browser/browser_context.h" 13 #include "content/public/browser/browser_context.h"
13 #include "content/public/browser/devtools_agent_host.h" 14 #include "content/public/browser/devtools_agent_host.h"
14 #include "content/public/browser/render_process_host.h" 15 #include "content/public/browser/render_process_host.h"
15 #include "content/public/browser/site_instance.h" 16 #include "content/public/browser/site_instance.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
17 #include "extensions/browser/app_window/app_window.h" 18 #include "extensions/browser/app_window/app_window.h"
18 #include "extensions/browser/app_window/native_app_window.h" 19 #include "extensions/browser/app_window/native_app_window.h"
19 #include "extensions/browser/extensions_browser_client.h" 20 #include "extensions/browser/extensions_browser_client.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 182 }
182 183
183 void AppWindowRegistry::DevToolsAgentHostDetached( 184 void AppWindowRegistry::DevToolsAgentHostDetached(
184 content::DevToolsAgentHost* agent_host) { 185 content::DevToolsAgentHost* agent_host) {
185 std::string key = GetWindowKeyForAgentHost(agent_host); 186 std::string key = GetWindowKeyForAgentHost(agent_host);
186 if (!key.empty()) 187 if (!key.empty())
187 inspected_windows_.erase(key); 188 inspected_windows_.erase(key);
188 } 189 }
189 190
190 void AppWindowRegistry::AddAppWindowToList(AppWindow* app_window) { 191 void AppWindowRegistry::AddAppWindowToList(AppWindow* app_window) {
191 const AppWindowList::iterator it = 192 if (base::ContainsValue(app_windows_, app_window))
192 std::find(app_windows_.begin(), app_windows_.end(), app_window);
193 if (it != app_windows_.end())
194 return; 193 return;
195 app_windows_.push_back(app_window); 194 app_windows_.push_back(app_window);
196 } 195 }
197 196
198 void AppWindowRegistry::BringToFront(AppWindow* app_window) { 197 void AppWindowRegistry::BringToFront(AppWindow* app_window) {
199 const AppWindowList::iterator it = 198 const AppWindowList::iterator it =
200 std::find(app_windows_.begin(), app_windows_.end(), app_window); 199 std::find(app_windows_.begin(), app_windows_.end(), app_window);
201 if (it != app_windows_.end()) 200 if (it != app_windows_.end())
202 app_windows_.erase(it); 201 app_windows_.erase(it);
203 app_windows_.push_front(app_window); 202 app_windows_.push_front(app_window);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 bool AppWindowRegistry::Factory::ServiceIsNULLWhileTesting() const { 257 bool AppWindowRegistry::Factory::ServiceIsNULLWhileTesting() const {
259 return false; 258 return false;
260 } 259 }
261 260
262 content::BrowserContext* AppWindowRegistry::Factory::GetBrowserContextToUse( 261 content::BrowserContext* AppWindowRegistry::Factory::GetBrowserContextToUse(
263 content::BrowserContext* context) const { 262 content::BrowserContext* context) const {
264 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); 263 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
265 } 264 }
266 265
267 } // namespace extensions 266 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/web_request/web_request_api.cc ('k') | extensions/common/extension_l10n_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698