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

Unified Diff: chrome/browser/extensions/api/declarative_content/content_action.cc

Issue 899983002: Revert of Introduce HostID and de-couple Extensions from "script injection System" [browser side] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/declarative_content/content_action.cc
diff --git a/chrome/browser/extensions/api/declarative_content/content_action.cc b/chrome/browser/extensions/api/declarative_content/content_action.cc
index 235363ce1d871544fbea5ae7f4492d2b2ec1fe23..e0ff006e16d05bc8418a6014f331bb6300debe48 100644
--- a/chrome/browser/extensions/api/declarative_content/content_action.cc
+++ b/chrome/browser/extensions/api/declarative_content/content_action.cc
@@ -62,7 +62,6 @@ class ShowPageAction : public ContentAction {
static scoped_refptr<ContentAction> Create(
content::BrowserContext* browser_context,
- const HostID& host_id,
const Extension* extension,
const base::DictionaryValue* dict,
std::string* error,
@@ -126,7 +125,6 @@ class SetIcon : public ContentAction {
static scoped_refptr<ContentAction> Create(
content::BrowserContext* browser_context,
- const HostID& host_id,
const Extension* extension,
const base::DictionaryValue* dict,
std::string* error,
@@ -220,7 +218,6 @@ struct ContentActionFactory {
// not confirm to the validated JSON specification.
typedef scoped_refptr<ContentAction>(*FactoryMethod)(
content::BrowserContext* /* browser_context */,
- const HostID& host_id /* host id */,
const Extension* /* extension */,
const base::DictionaryValue* /* dict */,
std::string* /* error */,
@@ -266,7 +263,6 @@ RequestContentScript::ScriptData::~ScriptData() {}
// static
scoped_refptr<ContentAction> RequestContentScript::Create(
content::BrowserContext* browser_context,
- const HostID& host_id,
const Extension* extension,
const base::DictionaryValue* dict,
std::string* error,
@@ -277,7 +273,6 @@ scoped_refptr<ContentAction> RequestContentScript::Create(
return scoped_refptr<ContentAction>(new RequestContentScript(
browser_context,
- host_id,
extension,
script_data));
}
@@ -285,7 +280,6 @@ scoped_refptr<ContentAction> RequestContentScript::Create(
// static
scoped_refptr<ContentAction> RequestContentScript::CreateForTest(
DeclarativeUserScriptMaster* master,
- const HostID& host_id,
const Extension* extension,
const base::Value& json_action,
std::string* error,
@@ -313,7 +307,6 @@ scoped_refptr<ContentAction> RequestContentScript::CreateForTest(
// using a BrowserContext.
return scoped_refptr<ContentAction>(new RequestContentScript(
master,
- host_id,
extension,
script_data));
}
@@ -355,23 +348,21 @@ bool RequestContentScript::InitScriptData(const base::DictionaryValue* dict,
RequestContentScript::RequestContentScript(
content::BrowserContext* browser_context,
- const HostID& host_id,
const Extension* extension,
const ScriptData& script_data) {
- InitScript(host_id, extension, script_data);
+ InitScript(extension, script_data);
master_ = ExtensionSystem::Get(browser_context)
->declarative_user_script_manager()
- ->GetDeclarativeUserScriptMasterByID(host_id);
+ ->GetDeclarativeUserScriptMasterByID(extension->id());
AddScript();
}
RequestContentScript::RequestContentScript(
DeclarativeUserScriptMaster* master,
- const HostID& host_id,
const Extension* extension,
const ScriptData& script_data) {
- InitScript(host_id, extension, script_data);
+ InitScript(extension, script_data);
master_ = master;
AddScript();
@@ -382,11 +373,10 @@ RequestContentScript::~RequestContentScript() {
master_->RemoveScript(script_);
}
-void RequestContentScript::InitScript(const HostID& host_id,
- const Extension* extension,
+void RequestContentScript::InitScript(const Extension* extension,
const ScriptData& script_data) {
script_.set_id(UserScript::GenerateUserScriptID());
- script_.set_host_id(host_id);
+ script_.set_extension_id(extension->id());
script_.set_run_location(UserScript::BROWSER_DRIVEN);
script_.set_match_all_frames(script_data.all_frames);
script_.set_match_about_blank(script_data.match_about_blank);
@@ -443,7 +433,6 @@ void RequestContentScript::InstructRenderProcessToInject(
// static
scoped_refptr<ContentAction> SetIcon::Create(
content::BrowserContext* browser_context,
- const HostID& host_id,
const Extension* extension,
const base::DictionaryValue* dict,
std::string* error,
@@ -481,7 +470,6 @@ ContentAction::~ContentAction() {}
// static
scoped_refptr<ContentAction> ContentAction::Create(
content::BrowserContext* browser_context,
- const HostID& host_id,
const Extension* extension,
const base::Value& json_action,
std::string* error,
@@ -497,7 +485,7 @@ scoped_refptr<ContentAction> ContentAction::Create(
factory_method_iter = factory.factory_methods.find(instance_type);
if (factory_method_iter != factory.factory_methods.end())
return (*factory_method_iter->second)(
- browser_context, host_id, extension, action_dict, error, bad_message);
+ browser_context, extension, action_dict, error, bad_message);
*error = base::StringPrintf(kInvalidInstanceTypeError, instance_type.c_str());
return scoped_refptr<ContentAction>();

Powered by Google App Engine
This is Rietveld 408576698