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

Side by Side Diff: extensions/browser/declarative_user_script_master.cc

Issue 2228743002: Rework some UserScriptLoader logic in preparation to removing UserScript copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/declarative_user_script_master.h" 5 #include "extensions/browser/declarative_user_script_master.h"
6 6
7 #include "content/public/browser/browser_context.h" 7 #include "content/public/browser/browser_context.h"
8 #include "extensions/browser/extension_user_script_loader.h" 8 #include "extensions/browser/extension_user_script_loader.h"
9 #include "extensions/browser/user_script_loader.h" 9 #include "extensions/browser/user_script_loader.h"
10 #include "extensions/browser/web_ui_user_script_loader.h" 10 #include "extensions/browser/web_ui_user_script_loader.h"
(...skipping 14 matching lines...) Expand all
25 case HostID::WEBUI: 25 case HostID::WEBUI:
26 loader_.reset(new WebUIUserScriptLoader(browser_context, host_id)); 26 loader_.reset(new WebUIUserScriptLoader(browser_context, host_id));
27 break; 27 break;
28 } 28 }
29 } 29 }
30 30
31 DeclarativeUserScriptMaster::~DeclarativeUserScriptMaster() { 31 DeclarativeUserScriptMaster::~DeclarativeUserScriptMaster() {
32 } 32 }
33 33
34 void DeclarativeUserScriptMaster::AddScript(const UserScript& script) { 34 void DeclarativeUserScriptMaster::AddScript(const UserScript& script) {
35 std::set<UserScript> set; 35 UserScriptList scripts;
36 set.insert(script); 36 scripts.push_back(script);
37 loader_->AddScripts(set); 37 loader_->AddScripts(scripts);
Devlin 2016/08/09 23:28:54 loader_->AddScripts(UserScriptList(1, script)); ?
lazyboy 2016/08/10 00:03:41 Done.
38 } 38 }
39 39
40 void DeclarativeUserScriptMaster::AddScripts( 40 void DeclarativeUserScriptMaster::AddScripts(const UserScriptList& scripts,
41 const std::set<UserScript>& scripts, 41 int render_process_id,
42 int render_process_id, 42 int render_view_id) {
43 int render_view_id) {
44 loader_->AddScripts(scripts, render_process_id, render_view_id); 43 loader_->AddScripts(scripts, render_process_id, render_view_id);
45 } 44 }
46 45
47 void DeclarativeUserScriptMaster::RemoveScript(const UserScript& script) { 46 void DeclarativeUserScriptMaster::RemoveScript(const UserScript& script) {
48 std::set<UserScript> set; 47 std::set<UserScriptIDPair> set;
49 set.insert(script); 48 set.insert(UserScriptIDPair(script.id(), script.host_id()));
50 loader_->RemoveScripts(set); 49 loader_->RemoveScripts(set);
51 } 50 }
52 51
53 void DeclarativeUserScriptMaster::RemoveScripts( 52 void DeclarativeUserScriptMaster::RemoveScripts(
54 const std::set<UserScript>& scripts) { 53 const std::set<UserScriptIDPair>& scripts) {
55 loader_->RemoveScripts(scripts); 54 loader_->RemoveScripts(scripts);
56 } 55 }
57 56
58 void DeclarativeUserScriptMaster::ClearScripts() { 57 void DeclarativeUserScriptMaster::ClearScripts() {
59 loader_->ClearScripts(); 58 loader_->ClearScripts();
60 } 59 }
61 60
62 } // namespace extensions 61 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698