OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/extensions/declarative_user_script_manager.h" | |
6 | |
7 #include "chrome/browser/extensions/declarative_user_script_master.h" | |
8 #include "content/public/browser/browser_context.h" | |
9 | |
10 namespace extensions { | |
11 | |
12 DeclarativeUserScriptManager::DeclarativeUserScriptManager(Profile* profile) | |
13 : profile_(profile) { | |
14 } | |
15 | |
16 DeclarativeUserScriptManager::~DeclarativeUserScriptManager() { | |
17 } | |
18 | |
19 DeclarativeUserScriptMaster* | |
20 DeclarativeUserScriptManager::GetDeclarativeUserScriptMasterByID( | |
21 const ExtensionId& extension_id) { | |
22 DeclarativeUserScriptMaster* master = NULL; | |
23 for (ScopedVector<DeclarativeUserScriptMaster>::iterator it = | |
Fady Samuel
2014/12/11 19:58:27
Why not use a map?
| |
24 declarative_user_script_masters_.begin(); | |
25 it != declarative_user_script_masters_.end(); | |
26 ++it) { | |
27 if ((*it)->extension_id() == extension_id) { | |
28 master = *it; | |
29 break; | |
30 } | |
31 } | |
32 if (!master) { | |
33 master = new DeclarativeUserScriptMaster(profile_, extension_id); | |
34 declarative_user_script_masters_.push_back(master); | |
35 } | |
36 return master; | |
37 } | |
38 | |
39 } // extensions | |
OLD | NEW |