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

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

Issue 2227193002: Make UserScript non-copyable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove browser/renderer specific file impl as it is not helping much 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 13 matching lines...) Expand all
24 break; 24 break;
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(
35 loader_->AddScripts(UserScriptList(1, script)); 35 std::unique_ptr<UserScript> script) {
Devlin 2016/08/17 16:39:31 Can we not use this vector ctor with non-movable t
lazyboy 2016/08/17 18:55:52 I can't seem to get std::unique_ptr<UserScriptList
36 UserScriptList scripts;
37 scripts.push_back(std::move(script));
38 loader_->AddScripts(scripts);
36 } 39 }
37 40
38 void DeclarativeUserScriptMaster::AddScripts(const UserScriptList& scripts, 41 void DeclarativeUserScriptMaster::AddScripts(UserScriptList& scripts,
39 int render_process_id, 42 int render_process_id,
40 int render_view_id) { 43 int render_view_id) {
41 loader_->AddScripts(scripts, render_process_id, render_view_id); 44 loader_->AddScripts(scripts, render_process_id, render_view_id);
42 } 45 }
43 46
44 void DeclarativeUserScriptMaster::RemoveScript(const UserScript& script) { 47 void DeclarativeUserScriptMaster::RemoveScript(const UserScriptIDPair& script) {
45 std::set<UserScriptIDPair> set; 48 std::set<UserScriptIDPair> scripts;
46 set.insert(UserScriptIDPair(script.id(), script.host_id())); 49 scripts.insert(script);
47 loader_->RemoveScripts(set); 50 RemoveScripts(scripts);
48 } 51 }
49 52
50 void DeclarativeUserScriptMaster::RemoveScripts( 53 void DeclarativeUserScriptMaster::RemoveScripts(
51 const std::set<UserScriptIDPair>& scripts) { 54 const std::set<UserScriptIDPair>& scripts) {
52 loader_->RemoveScripts(scripts); 55 loader_->RemoveScripts(scripts);
53 } 56 }
54 57
55 void DeclarativeUserScriptMaster::ClearScripts() { 58 void DeclarativeUserScriptMaster::ClearScripts() {
56 loader_->ClearScripts(); 59 loader_->ClearScripts();
57 } 60 }
58 61
59 } // namespace extensions 62 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698