[Extensions] Rename ActiveScriptController to ExtensionActionExecutor
The ActiveScriptController will control more than just active scripts (e.g.,
webRequests), so calling it that doesn't really make sense. Rename to
ExtensionActionExecutor.
BUG=
Review URL: https://codereview.chromium.org/1804753002
Cr-Commit-Position: refs/heads/master@{#381276}
diff --git a/chrome/browser/extensions/active_tab_permission_granter.cc b/chrome/browser/extensions/active_tab_permission_granter.cc
index af0f344..f00ef4d1 100644
--- a/chrome/browser/extensions/active_tab_permission_granter.cc
+++ b/chrome/browser/extensions/active_tab_permission_granter.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/extensions/active_tab_permission_granter.h"
-#include "chrome/browser/extensions/active_script_controller.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
@@ -129,7 +129,7 @@
// It's important that this comes after the IPC is sent to the renderer,
// so that any tasks executing in the renderer occur after it has the
// updated permissions.
- ActiveScriptController::GetForWebContents(web_contents())
+ ExtensionActionRunner::GetForWebContents(web_contents())
->OnActiveTabPermissionGranted(extension);
}
}
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
index 4a6ca8d..d24ca22 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc
+++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
@@ -14,8 +14,8 @@
#include "base/strings/string_number_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
-#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/extension_action_manager.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/tab_helper.h"
@@ -181,13 +181,11 @@
int tab_id = SessionTabHelper::IdForTab(web_contents);
- ActiveScriptController* active_script_controller =
- ActiveScriptController::GetForWebContents(web_contents);
+ ExtensionActionRunner* action_runner =
+ ExtensionActionRunner::GetForWebContents(web_contents);
bool has_pending_scripts = false;
- if (active_script_controller &&
- active_script_controller->WantsToRun(extension)) {
+ if (action_runner && action_runner->WantsToRun(extension))
has_pending_scripts = true;
- }
// Grant active tab if appropriate.
if (grant_active_tab_permissions) {
@@ -259,10 +257,9 @@
bool ExtensionActionAPI::HasBeenBlocked(const Extension* extension,
content::WebContents* web_contents) {
- ActiveScriptController* active_script_controller =
- ActiveScriptController::GetForWebContents(web_contents);
- return active_script_controller &&
- active_script_controller->WantsToRun(extension);
+ ExtensionActionRunner* action_runner =
+ ExtensionActionRunner::GetForWebContents(web_contents);
+ return action_runner && action_runner->WantsToRun(extension);
}
void ExtensionActionAPI::NotifyChange(ExtensionAction* extension_action,
diff --git a/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.cc b/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.cc
index 7d65aeb5..bd33fa6 100644
--- a/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.cc
+++ b/chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.cc
@@ -4,9 +4,9 @@
#include "chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.h"
-#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/activity_log/activity_action_constants.h"
#include "chrome/browser/extensions/activity_log/activity_log.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_renderer_state.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/resource_request_info.h"
@@ -38,7 +38,7 @@
int render_frame_id,
const std::string& extension_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- // Track down the ActiveScriptController and the extension. Since this is
+ // Track down the ExtensionActionRunner and the extension. Since this is
// asynchronous, we could hit a null anywhere along the path.
content::RenderFrameHost* rfh =
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
@@ -48,9 +48,9 @@
content::WebContents::FromRenderFrameHost(rfh);
if (!web_contents)
return;
- extensions::ActiveScriptController* controller =
- extensions::ActiveScriptController::GetForWebContents(web_contents);
- if (!controller)
+ extensions::ExtensionActionRunner* runner =
+ extensions::ExtensionActionRunner::GetForWebContents(web_contents);
+ if (!runner)
return;
const extensions::Extension* extension =
@@ -60,7 +60,7 @@
if (!extension)
return;
- controller->OnWebRequestBlocked(extension);
+ runner->OnWebRequestBlocked(extension);
}
} // namespace
diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
index 5f510f94..5ac6f8c 100644
--- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -7,8 +7,8 @@
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/active_tab_permission_granter.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/tab_helper.h"
@@ -511,9 +511,9 @@
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(web_contents);
- ActiveScriptController* controller =
- ActiveScriptController::GetForWebContents(web_contents);
- ASSERT_TRUE(controller);
+ ExtensionActionRunner* runner =
+ ExtensionActionRunner::GetForWebContents(web_contents);
+ ASSERT_TRUE(runner);
int port = embedded_test_server()->port();
const std::string kXhrPath = "simple.html";
@@ -526,10 +526,9 @@
// Grant activeTab permission, and perform another XHR. The extension should
// receive the event.
- EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST,
- controller->GetBlockedActions(extension));
- controller->OnClicked(extension);
- EXPECT_EQ(BLOCKED_ACTION_NONE, controller->GetBlockedActions(extension));
+ EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner->GetBlockedActions(extension));
+ runner->OnClicked(extension);
+ EXPECT_EQ(BLOCKED_ACTION_NONE, runner->GetBlockedActions(extension));
PerformXhrInPage(web_contents, kHost, port, kXhrPath);
EXPECT_EQ(1, GetWebRequestCountFromBackgroundPage(extension, profile()));
@@ -542,8 +541,7 @@
base::RunLoop().RunUntilIdle();
PerformXhrInPage(web_contents, kHost, port, kXhrPath);
EXPECT_EQ(1, GetWebRequestCountFromBackgroundPage(extension, profile()));
- EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST,
- controller->GetBlockedActions(extension));
+ EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner->GetBlockedActions(extension));
}
} // namespace extensions
diff --git a/chrome/browser/extensions/active_script_controller.cc b/chrome/browser/extensions/extension_action_runner.cc
similarity index 82%
rename from chrome/browser/extensions/active_script_controller.cc
rename to chrome/browser/extensions/extension_action_runner.cc
index cb4ba00..bcbb7e7 100644
--- a/chrome/browser/extensions/active_script_controller.cc
+++ b/chrome/browser/extensions/extension_action_runner.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/extensions/active_script_controller.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -35,18 +35,17 @@
namespace extensions {
-ActiveScriptController::PendingScript::PendingScript(
+ExtensionActionRunner::PendingScript::PendingScript(
UserScript::RunLocation run_location,
const base::Closure& permit_script)
: run_location(run_location), permit_script(permit_script) {}
-ActiveScriptController::PendingScript::PendingScript(
+ExtensionActionRunner::PendingScript::PendingScript(
const PendingScript& other) = default;
-ActiveScriptController::PendingScript::~PendingScript() {}
+ExtensionActionRunner::PendingScript::~PendingScript() {}
-ActiveScriptController::ActiveScriptController(
- content::WebContents* web_contents)
+ExtensionActionRunner::ExtensionActionRunner(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
num_page_requests_(0),
browser_context_(web_contents->GetBrowserContext()),
@@ -56,26 +55,26 @@
extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_));
}
-ActiveScriptController::~ActiveScriptController() {
+ExtensionActionRunner::~ExtensionActionRunner() {
LogUMA();
}
// static
-ActiveScriptController* ActiveScriptController::GetForWebContents(
+ExtensionActionRunner* ExtensionActionRunner::GetForWebContents(
content::WebContents* web_contents) {
if (!web_contents)
return NULL;
TabHelper* tab_helper = TabHelper::FromWebContents(web_contents);
- return tab_helper ? tab_helper->active_script_controller() : NULL;
+ return tab_helper ? tab_helper->extension_action_runner() : NULL;
}
-void ActiveScriptController::OnActiveTabPermissionGranted(
+void ExtensionActionRunner::OnActiveTabPermissionGranted(
const Extension* extension) {
if (WantsToRun(extension))
OnClicked(extension);
}
-void ActiveScriptController::OnClicked(const Extension* extension) {
+void ExtensionActionRunner::OnClicked(const Extension* extension) {
DCHECK(ContainsKey(pending_scripts_, extension->id()) ||
web_request_blocked_.count(extension->id()) != 0);
@@ -95,11 +94,11 @@
NotifyChange(extension);
}
-void ActiveScriptController::OnWebRequestBlocked(const Extension* extension) {
+void ExtensionActionRunner::OnWebRequestBlocked(const Extension* extension) {
web_request_blocked_.insert(extension->id());
}
-int ActiveScriptController::GetBlockedActions(const Extension* extension) {
+int ExtensionActionRunner::GetBlockedActions(const Extension* extension) {
int blocked_actions = BLOCKED_ACTION_NONE;
if (web_request_blocked_.count(extension->id()) != 0)
blocked_actions |= BLOCKED_ACTION_WEB_REQUEST;
@@ -126,12 +125,12 @@
return blocked_actions;
}
-bool ActiveScriptController::WantsToRun(const Extension* extension) {
+bool ExtensionActionRunner::WantsToRun(const Extension* extension) {
return GetBlockedActions(extension) != BLOCKED_ACTION_NONE;
}
PermissionsData::AccessType
-ActiveScriptController::RequiresUserConsentForScriptInjection(
+ExtensionActionRunner::RequiresUserConsentForScriptInjection(
const Extension* extension,
UserScript::InjectionType type) {
CHECK(extension);
@@ -155,7 +154,7 @@
return PermissionsData::ACCESS_DENIED;
}
-void ActiveScriptController::RequestScriptInjection(
+void ExtensionActionRunner::RequestScriptInjection(
const Extension* extension,
UserScript::RunLocation run_location,
const base::Closure& callback) {
@@ -171,7 +170,7 @@
was_used_on_page_ = true;
}
-void ActiveScriptController::RunPendingScriptsForExtension(
+void ExtensionActionRunner::RunPendingScriptsForExtension(
const Extension* extension) {
DCHECK(extension);
@@ -200,7 +199,7 @@
pending_script.permit_script.Run();
}
-void ActiveScriptController::OnRequestScriptInjectionPermission(
+void ExtensionActionRunner::OnRequestScriptInjectionPermission(
const std::string& extension_id,
UserScript::InjectionType script_type,
UserScript::RunLocation run_location,
@@ -210,9 +209,9 @@
return;
}
- const Extension* extension =
- ExtensionRegistry::Get(browser_context_)
- ->enabled_extensions().GetByID(extension_id);
+ const Extension* extension = ExtensionRegistry::Get(browser_context_)
+ ->enabled_extensions()
+ .GetByID(extension_id);
// We shouldn't allow extensions which are no longer enabled to run any
// scripts. Ignore the request.
if (!extension)
@@ -229,7 +228,7 @@
// by this object.
RequestScriptInjection(
extension, run_location,
- base::Bind(&ActiveScriptController::PermitScriptInjection,
+ base::Bind(&ExtensionActionRunner::PermitScriptInjection,
base::Unretained(this), request_id));
break;
case PermissionsData::ACCESS_DENIED:
@@ -240,7 +239,7 @@
}
}
-void ActiveScriptController::PermitScriptInjection(int64_t request_id) {
+void ExtensionActionRunner::PermitScriptInjection(int64_t request_id) {
// This only sends the response to the renderer - the process of adding the
// extension to the list of |permitted_extensions_| is done elsewhere.
// TODO(devlin): Instead of sending this to all frames, we should include the
@@ -251,23 +250,23 @@
request_id));
}
-void ActiveScriptController::NotifyChange(const Extension* extension) {
+void ExtensionActionRunner::NotifyChange(const Extension* extension) {
ExtensionActionAPI* extension_action_api =
ExtensionActionAPI::Get(browser_context_);
ExtensionAction* extension_action =
- ExtensionActionManager::Get(browser_context_)->
- GetExtensionAction(*extension);
+ ExtensionActionManager::Get(browser_context_)
+ ->GetExtensionAction(*extension);
// If the extension has an action, we need to notify that it's updated.
if (extension_action) {
- extension_action_api->NotifyChange(
- extension_action, web_contents(), browser_context_);
+ extension_action_api->NotifyChange(extension_action, web_contents(),
+ browser_context_);
}
// We also notify that page actions may have changed.
extension_action_api->NotifyPageActionsChanged(web_contents());
}
-void ActiveScriptController::LogUMA() const {
+void ExtensionActionRunner::LogUMA() const {
// We only log the permitted extensions metric if the feature was used at all
// on the page, because otherwise the data will be boring.
if (was_used_on_page_) {
@@ -280,11 +279,11 @@
}
}
-bool ActiveScriptController::OnMessageReceived(
+bool ExtensionActionRunner::OnMessageReceived(
const IPC::Message& message,
content::RenderFrameHost* render_frame_host) {
bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(ActiveScriptController, message)
+ IPC_BEGIN_MESSAGE_MAP(ExtensionActionRunner, message)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_RequestScriptInjectionPermission,
OnRequestScriptInjectionPermission)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -292,7 +291,7 @@
return handled;
}
-void ActiveScriptController::DidNavigateMainFrame(
+void ExtensionActionRunner::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
if (details.is_in_page)
@@ -306,15 +305,15 @@
was_used_on_page_ = false;
}
-void ActiveScriptController::OnExtensionUnloaded(
+void ExtensionActionRunner::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionInfo::Reason reason) {
PendingScriptMap::iterator iter = pending_scripts_.find(extension->id());
if (iter != pending_scripts_.end()) {
pending_scripts_.erase(iter);
- ExtensionActionAPI::Get(browser_context_)->
- NotifyPageActionsChanged(web_contents());
+ ExtensionActionAPI::Get(browser_context_)
+ ->NotifyPageActionsChanged(web_contents());
}
}
diff --git a/chrome/browser/extensions/active_script_controller.h b/chrome/browser/extensions/extension_action_runner.h
similarity index 87%
rename from chrome/browser/extensions/active_script_controller.h
rename to chrome/browser/extensions/extension_action_runner.h
index 94e8f374..5b92ec2 100644
--- a/chrome/browser/extensions/active_script_controller.h
+++ b/chrome/browser/extensions/extension_action_runner.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_
-#define CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_RUNNER_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_RUNNER_H_
#include <stdint.h>
@@ -39,25 +39,23 @@
// The provider for ExtensionActions corresponding to scripts which are actively
// running or need permission.
-// TODO(rdevlin.cronin): This isn't really a controller, but it has good parity
-// with LocationBar"Controller".
-class ActiveScriptController : public content::WebContentsObserver,
- public ExtensionRegistryObserver {
+class ExtensionActionRunner : public content::WebContentsObserver,
+ public ExtensionRegistryObserver {
public:
- explicit ActiveScriptController(content::WebContents* web_contents);
- ~ActiveScriptController() override;
+ explicit ExtensionActionRunner(content::WebContents* web_contents);
+ ~ExtensionActionRunner() override;
- // Returns the ActiveScriptController for the given |web_contents|, or NULL
+ // Returns the ExtensionActionRunner for the given |web_contents|, or NULL
// if one does not exist.
- static ActiveScriptController* GetForWebContents(
+ static ExtensionActionRunner* GetForWebContents(
content::WebContents* web_contents);
- // Notifies the ActiveScriptController that an extension has been granted
+ // Notifies the ExtensionActionRunner that an extension has been granted
// active tab permissions. This will run any pending injections for that
// extension.
void OnActiveTabPermissionGranted(const Extension* extension);
- // Notifies the ActiveScriptController that the action for |extension| has
+ // Notifies the ExtensionActionRunner that the action for |extension| has
// been clicked, running any pending tasks that were previously shelved.
void OnClicked(const Extension* extension);
@@ -175,9 +173,9 @@
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_registry_observer_;
- DISALLOW_COPY_AND_ASSIGN(ActiveScriptController);
+ DISALLOW_COPY_AND_ASSIGN(ExtensionActionRunner);
};
} // namespace extensions
-#endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_SCRIPT_CONTROLLER_H_
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_RUNNER_H_
diff --git a/chrome/browser/extensions/active_script_controller_browsertest.cc b/chrome/browser/extensions/extension_action_runner_browsertest.cc
similarity index 73%
rename from chrome/browser/extensions/active_script_controller_browsertest.cc
rename to chrome/browser/extensions/extension_action_runner_browsertest.cc
index ff8ac9b..c71cdf1 100644
--- a/chrome/browser/extensions/active_script_controller_browsertest.cc
+++ b/chrome/browser/extensions/extension_action_runner_browsertest.cc
@@ -11,8 +11,8 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/stringprintf.h"
-#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/extension_action.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/tab_helper.h"
@@ -48,20 +48,11 @@
const char kInjectSucceeded[] = "inject succeeded";
-enum InjectionType {
- CONTENT_SCRIPT,
- EXECUTE_SCRIPT
-};
+enum InjectionType { CONTENT_SCRIPT, EXECUTE_SCRIPT };
-enum HostType {
- ALL_HOSTS,
- EXPLICIT_HOSTS
-};
+enum HostType { ALL_HOSTS, EXPLICIT_HOSTS };
-enum RequiresConsent {
- REQUIRES_CONSENT,
- DOES_NOT_REQUIRE_CONSENT
-};
+enum RequiresConsent { REQUIRES_CONSENT, DOES_NOT_REQUIRE_CONSENT };
// Runs all pending tasks in the renderer associated with |web_contents|.
// Returns true on success.
@@ -74,9 +65,9 @@
} // namespace
-class ActiveScriptControllerBrowserTest : public ExtensionBrowserTest {
+class ExtensionActionRunnerBrowserTest : public ExtensionBrowserTest {
public:
- ActiveScriptControllerBrowserTest() {}
+ ExtensionActionRunnerBrowserTest() {}
void SetUpCommandLine(base::CommandLine* command_line) override;
void TearDownOnMainThread() override;
@@ -93,7 +84,7 @@
std::vector<const Extension*> extensions_;
};
-void ActiveScriptControllerBrowserTest::SetUpCommandLine(
+void ExtensionActionRunnerBrowserTest::SetUpCommandLine(
base::CommandLine* command_line) {
ExtensionBrowserTest::SetUpCommandLine(command_line);
// We append the actual switch to the commandline because it needs to be
@@ -102,18 +93,17 @@
command_line->AppendSwitch(switches::kEnableScriptsRequireAction);
}
-void ActiveScriptControllerBrowserTest::TearDownOnMainThread() {
+void ExtensionActionRunnerBrowserTest::TearDownOnMainThread() {
test_extension_dirs_.clear();
}
-const Extension* ActiveScriptControllerBrowserTest::CreateExtension(
- HostType host_type, InjectionType injection_type) {
- std::string name =
- base::StringPrintf(
- "%s %s",
- injection_type == CONTENT_SCRIPT ?
- "content_script" : "execute_script",
- host_type == ALL_HOSTS ? "all_hosts" : "explicit_hosts");
+const Extension* ExtensionActionRunnerBrowserTest::CreateExtension(
+ HostType host_type,
+ InjectionType injection_type) {
+ std::string name = base::StringPrintf(
+ "%s %s",
+ injection_type == CONTENT_SCRIPT ? "content_script" : "execute_script",
+ host_type == ALL_HOSTS ? "all_hosts" : "explicit_hosts");
const char* const permission_scheme =
host_type == ALL_HOSTS ? kAllHostsScheme : kExplicitHostsScheme;
@@ -145,15 +135,13 @@
" %s,"
" %s"
"}",
- name.c_str(),
- permissions.c_str(),
- scripts.c_str());
+ name.c_str(), permissions.c_str(), scripts.c_str());
scoped_ptr<TestExtensionDir> dir(new TestExtensionDir);
dir->WriteManifest(manifest);
dir->WriteFile(FILE_PATH_LITERAL("script.js"),
- injection_type == CONTENT_SCRIPT ? kContentScriptSource :
- kBackgroundScriptSource);
+ injection_type == CONTENT_SCRIPT ? kContentScriptSource
+ : kBackgroundScriptSource);
const Extension* extension = LoadExtension(dir->unpacked_path());
if (extension) {
@@ -177,11 +165,11 @@
testing::AssertionResult Verify();
private:
- // Returns the active script controller, or NULL if one does not exist.
- ActiveScriptController* GetActiveScriptController();
+ // Returns the ExtensionActionRunner, or null if one does not exist.
+ ExtensionActionRunner* GetExtensionActionRunner();
- // Returns true if the extension has a pending request with the active script
- // controller.
+ // Returns true if the extension has a pending request with the
+ // ExtensionActionRunner.
bool WantsToRun();
// The name of the extension, and also the message it sends.
@@ -222,8 +210,7 @@
inject_success_listener_->set_extension_id(extension->id());
}
-ActiveScriptTester::~ActiveScriptTester() {
-}
+ActiveScriptTester::~ActiveScriptTester() {}
testing::AssertionResult ActiveScriptTester::Verify() {
if (!extension_)
@@ -241,9 +228,9 @@
// Make sure all running tasks are complete.
content::RunAllPendingInMessageLoop();
- ActiveScriptController* controller = GetActiveScriptController();
- if (!controller)
- return testing::AssertionFailure() << "Could not find controller.";
+ ExtensionActionRunner* runner = GetExtensionActionRunner();
+ if (!runner)
+ return testing::AssertionFailure() << "Could not find runner.";
bool wants_to_run = WantsToRun();
@@ -251,9 +238,9 @@
if ((requires_consent_ == REQUIRES_CONSENT && !wants_to_run) ||
(requires_consent_ == DOES_NOT_REQUIRE_CONSENT && wants_to_run)) {
return testing::AssertionFailure()
- << "Improper wants to run for " << name_ << ": expected "
- << (requires_consent_ == REQUIRES_CONSENT) << ", found "
- << wants_to_run;
+ << "Improper wants to run for " << name_ << ": expected "
+ << (requires_consent_ == REQUIRES_CONSENT) << ", found "
+ << wants_to_run;
}
// If the extension has permission, we should be able to simply wait for it
@@ -266,15 +253,15 @@
// Otherwise, we don't have permission, and have to grant it. Ensure the
// script has *not* already executed.
if (inject_success_listener_->was_satisfied()) {
- return testing::AssertionFailure() <<
- name_ << "'s script ran without permission.";
+ return testing::AssertionFailure() << name_
+ << "'s script ran without permission.";
}
// If we reach this point, we should always want to run.
DCHECK(wants_to_run);
// Grant permission by clicking on the extension action.
- controller->OnClicked(extension_);
+ runner->OnClicked(extension_);
// Now, the extension should be able to inject the script.
inject_success_listener_->WaitUntilSatisfied();
@@ -283,39 +270,30 @@
wants_to_run = WantsToRun();
if (wants_to_run) {
return testing::AssertionFailure()
- << "Extension " << name_ << " still wants to run after injecting.";
+ << "Extension " << name_ << " still wants to run after injecting.";
}
return testing::AssertionSuccess();
}
-ActiveScriptController* ActiveScriptTester::GetActiveScriptController() {
- content::WebContents* web_contents =
- browser_ ? browser_->tab_strip_model()->GetActiveWebContents() : NULL;
-
- if (!web_contents)
- return NULL;
-
- TabHelper* tab_helper = TabHelper::FromWebContents(web_contents);
- return tab_helper ? tab_helper->active_script_controller() : NULL;
+ExtensionActionRunner* ActiveScriptTester::GetExtensionActionRunner() {
+ return ExtensionActionRunner::GetForWebContents(
+ browser_ ? browser_->tab_strip_model()->GetActiveWebContents() : nullptr);
}
bool ActiveScriptTester::WantsToRun() {
- ActiveScriptController* controller = GetActiveScriptController();
- return controller ? controller->WantsToRun(extension_) : false;
+ ExtensionActionRunner* runner = GetExtensionActionRunner();
+ return runner ? runner->WantsToRun(extension_) : false;
}
-IN_PROC_BROWSER_TEST_F(ActiveScriptControllerBrowserTest,
+IN_PROC_BROWSER_TEST_F(ExtensionActionRunnerBrowserTest,
ActiveScriptsAreDisplayedAndDelayExecution) {
base::FilePath active_script_path =
test_data_dir_.AppendASCII("active_script");
const char* const kExtensionNames[] = {
- "inject_scripts_all_hosts",
- "inject_scripts_explicit_hosts",
- "content_scripts_all_hosts",
- "content_scripts_explicit_hosts"
- };
+ "inject_scripts_all_hosts", "inject_scripts_explicit_hosts",
+ "content_scripts_all_hosts", "content_scripts_explicit_hosts"};
// First, we load up three extensions:
// - An extension that injects scripts into all hosts,
@@ -325,30 +303,18 @@
// The extensions that operate on explicit hosts have permission; the ones
// that request all hosts require user consent.
ActiveScriptTester testers[] = {
- ActiveScriptTester(
- kExtensionNames[0],
- CreateExtension(ALL_HOSTS, EXECUTE_SCRIPT),
- browser(),
- REQUIRES_CONSENT,
- EXECUTE_SCRIPT),
- ActiveScriptTester(
- kExtensionNames[1],
- CreateExtension(EXPLICIT_HOSTS, EXECUTE_SCRIPT),
- browser(),
- DOES_NOT_REQUIRE_CONSENT,
- EXECUTE_SCRIPT),
- ActiveScriptTester(
- kExtensionNames[2],
- CreateExtension(ALL_HOSTS, CONTENT_SCRIPT),
- browser(),
- REQUIRES_CONSENT,
- CONTENT_SCRIPT),
- ActiveScriptTester(
- kExtensionNames[3],
- CreateExtension(EXPLICIT_HOSTS, CONTENT_SCRIPT),
- browser(),
- DOES_NOT_REQUIRE_CONSENT,
- CONTENT_SCRIPT),
+ ActiveScriptTester(kExtensionNames[0],
+ CreateExtension(ALL_HOSTS, EXECUTE_SCRIPT), browser(),
+ REQUIRES_CONSENT, EXECUTE_SCRIPT),
+ ActiveScriptTester(kExtensionNames[1],
+ CreateExtension(EXPLICIT_HOSTS, EXECUTE_SCRIPT),
+ browser(), DOES_NOT_REQUIRE_CONSENT, EXECUTE_SCRIPT),
+ ActiveScriptTester(kExtensionNames[2],
+ CreateExtension(ALL_HOSTS, CONTENT_SCRIPT), browser(),
+ REQUIRES_CONSENT, CONTENT_SCRIPT),
+ ActiveScriptTester(kExtensionNames[3],
+ CreateExtension(EXPLICIT_HOSTS, CONTENT_SCRIPT),
+ browser(), DOES_NOT_REQUIRE_CONSENT, CONTENT_SCRIPT),
};
// Navigate to an URL (which matches the explicit host specified in the
@@ -365,7 +331,7 @@
// Test that removing an extension with pending injections a) removes the
// pending injections for that extension, and b) does not affect pending
// injections for other extensions.
-IN_PROC_BROWSER_TEST_F(ActiveScriptControllerBrowserTest,
+IN_PROC_BROWSER_TEST_F(ExtensionActionRunnerBrowserTest,
RemoveExtensionWithPendingInjections) {
// Load up two extensions, each with content scripts.
const Extension* extension1 = CreateExtension(ALL_HOSTS, CONTENT_SCRIPT);
@@ -378,17 +344,17 @@
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(web_contents);
- ActiveScriptController* active_script_controller =
- ActiveScriptController::GetForWebContents(web_contents);
- ASSERT_TRUE(active_script_controller);
+ ExtensionActionRunner* action_runner =
+ ExtensionActionRunner::GetForWebContents(web_contents);
+ ASSERT_TRUE(action_runner);
ASSERT_TRUE(embedded_test_server()->Start());
ui_test_utils::NavigateToURL(
browser(), embedded_test_server()->GetURL("/extensions/test_file.html"));
// Both extensions should have pending requests.
- EXPECT_TRUE(active_script_controller->WantsToRun(extension1));
- EXPECT_TRUE(active_script_controller->WantsToRun(extension2));
+ EXPECT_TRUE(action_runner->WantsToRun(extension1));
+ EXPECT_TRUE(action_runner->WantsToRun(extension2));
// Unload one of the extensions.
UnloadExtension(extension2->id());
@@ -397,23 +363,22 @@
// We should have pending requests for extension1, but not the removed
// extension2.
- EXPECT_TRUE(active_script_controller->WantsToRun(extension1));
- EXPECT_FALSE(active_script_controller->WantsToRun(extension2));
+ EXPECT_TRUE(action_runner->WantsToRun(extension1));
+ EXPECT_FALSE(action_runner->WantsToRun(extension2));
// We should still be able to run the request for extension1.
ExtensionTestMessageListener inject_success_listener(
new ExtensionTestMessageListener(kInjectSucceeded,
false /* won't reply */));
inject_success_listener.set_extension_id(extension1->id());
- active_script_controller->OnClicked(extension1);
+ action_runner->OnClicked(extension1);
inject_success_listener.WaitUntilSatisfied();
}
// Test that granting the extension all urls permission allows it to run on
// pages, and that the permission update is sent to existing renderers.
-IN_PROC_BROWSER_TEST_F(ActiveScriptControllerBrowserTest,
+IN_PROC_BROWSER_TEST_F(ExtensionActionRunnerBrowserTest,
GrantExtensionAllUrlsPermission) {
-
// Loadup an extension and navigate.
const Extension* extension = CreateExtension(ALL_HOSTS, CONTENT_SCRIPT);
ASSERT_TRUE(extension);
@@ -421,9 +386,9 @@
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(web_contents);
- ActiveScriptController* active_script_controller =
- ActiveScriptController::GetForWebContents(web_contents);
- ASSERT_TRUE(active_script_controller);
+ ExtensionActionRunner* action_runner =
+ ExtensionActionRunner::GetForWebContents(web_contents);
+ ASSERT_TRUE(action_runner);
ExtensionTestMessageListener inject_success_listener(
new ExtensionTestMessageListener(kInjectSucceeded,
@@ -435,8 +400,8 @@
ui_test_utils::NavigateToURL(browser(), url);
// The extension shouldn't be allowed to run.
- EXPECT_TRUE(active_script_controller->WantsToRun(extension));
- EXPECT_EQ(1, active_script_controller->num_page_requests());
+ EXPECT_TRUE(action_runner->WantsToRun(extension));
+ EXPECT_EQ(1, action_runner->num_page_requests());
EXPECT_FALSE(inject_success_listener.was_satisfied());
// Enable the extension to run on all urls.
@@ -446,8 +411,8 @@
// Navigate again - this time, the extension should execute immediately (and
// should not need to ask the script controller for permission).
ui_test_utils::NavigateToURL(browser(), url);
- EXPECT_FALSE(active_script_controller->WantsToRun(extension));
- EXPECT_EQ(0, active_script_controller->num_page_requests());
+ EXPECT_FALSE(action_runner->WantsToRun(extension));
+ EXPECT_EQ(0, action_runner->num_page_requests());
EXPECT_TRUE(inject_success_listener.WaitUntilSatisfied());
// Revoke all urls permissions.
@@ -457,15 +422,15 @@
// Re-navigate; the extension should again need permission to run.
ui_test_utils::NavigateToURL(browser(), url);
- EXPECT_TRUE(active_script_controller->WantsToRun(extension));
- EXPECT_EQ(1, active_script_controller->num_page_requests());
+ EXPECT_TRUE(action_runner->WantsToRun(extension));
+ EXPECT_EQ(1, action_runner->num_page_requests());
EXPECT_FALSE(inject_success_listener.was_satisfied());
}
// A version of the test with the flag off, in order to test that everything
// still works as expected.
-class FlagOffActiveScriptControllerBrowserTest
- : public ActiveScriptControllerBrowserTest {
+class FlagOffExtensionActionRunnerBrowserTest
+ : public ExtensionActionRunnerBrowserTest {
private:
// Simply don't append the flag.
void SetUpCommandLine(base::CommandLine* command_line) override {
@@ -473,25 +438,18 @@
}
};
-IN_PROC_BROWSER_TEST_F(FlagOffActiveScriptControllerBrowserTest,
+IN_PROC_BROWSER_TEST_F(FlagOffExtensionActionRunnerBrowserTest,
ScriptsExecuteWhenFlagAbsent) {
const char* const kExtensionNames[] = {
- "content_scripts_all_hosts",
- "inject_scripts_all_hosts",
+ "content_scripts_all_hosts", "inject_scripts_all_hosts",
};
ActiveScriptTester testers[] = {
- ActiveScriptTester(
- kExtensionNames[0],
- CreateExtension(ALL_HOSTS, CONTENT_SCRIPT),
- browser(),
- DOES_NOT_REQUIRE_CONSENT,
- CONTENT_SCRIPT),
- ActiveScriptTester(
- kExtensionNames[1],
- CreateExtension(ALL_HOSTS, EXECUTE_SCRIPT),
- browser(),
- DOES_NOT_REQUIRE_CONSENT,
- EXECUTE_SCRIPT),
+ ActiveScriptTester(kExtensionNames[0],
+ CreateExtension(ALL_HOSTS, CONTENT_SCRIPT), browser(),
+ DOES_NOT_REQUIRE_CONSENT, CONTENT_SCRIPT),
+ ActiveScriptTester(kExtensionNames[1],
+ CreateExtension(ALL_HOSTS, EXECUTE_SCRIPT), browser(),
+ DOES_NOT_REQUIRE_CONSENT, EXECUTE_SCRIPT),
};
ASSERT_TRUE(embedded_test_server()->Start());
diff --git a/chrome/browser/extensions/active_script_controller_unittest.cc b/chrome/browser/extensions/extension_action_runner_unittest.cc
similarity index 76%
rename from chrome/browser/extensions/active_script_controller_unittest.cc
rename to chrome/browser/extensions/extension_action_runner_unittest.cc
index b436ce44..badade89 100644
--- a/chrome/browser/extensions/active_script_controller_unittest.cc
+++ b/chrome/browser/extensions/extension_action_runner_unittest.cc
@@ -8,9 +8,9 @@
#include <utility>
#include "base/values.h"
-#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/active_tab_permission_granter.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_sync_service_factory.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/permissions_updater.h"
@@ -38,15 +38,15 @@
} // namespace
-// Unittests for the ActiveScriptController mostly test the internal logic
-// of the controller itself (when to allow/deny extension script injection).
+// Unittests for the ExtensionActionRunner mostly test the internal logic
+// of the runner itself (when to allow/deny extension script injection).
// Testing real injection is allowed/denied as expected (i.e., that the
-// ActiveScriptController correctly interfaces in the system) is done in the
-// ActiveScriptControllerBrowserTests.
-class ActiveScriptControllerUnitTest : public ChromeRenderViewHostTestHarness {
+// ExtensionActionRunner correctly interfaces in the system) is done in the
+// ExtensionActionRunnerBrowserTests.
+class ExtensionActionRunnerUnitTest : public ChromeRenderViewHostTestHarness {
protected:
- ActiveScriptControllerUnitTest();
- ~ActiveScriptControllerUnitTest() override;
+ ExtensionActionRunnerUnitTest();
+ ~ExtensionActionRunnerUnitTest() override;
// Creates an extension with all hosts permission and adds it to the registry.
const Extension* AddExtension();
@@ -66,9 +66,7 @@
// Returns the number of times a given extension has had a script execute.
size_t GetExecutionCountForExtension(const std::string& extension_id) const;
- ActiveScriptController* controller() const {
- return active_script_controller_;
- }
+ ExtensionActionRunner* runner() const { return extension_action_runner_; }
private:
// Returns a closure to use as a script execution for a given extension.
@@ -80,30 +78,29 @@
void SetUp() override;
- // Since ActiveScriptController's behavior is behind a flag, override the
+ // Since ExtensionActionRunner's behavior is behind a flag, override the
// feature switch.
FeatureSwitch::ScopedOverride feature_override_;
- // The associated ActiveScriptController.
- ActiveScriptController* active_script_controller_;
+ // The associated ExtensionActionRunner.
+ ExtensionActionRunner* extension_action_runner_;
// The map of observed executions, keyed by extension id.
std::map<std::string, int> extension_executions_;
scoped_refptr<const Extension> extension_;
- DISALLOW_COPY_AND_ASSIGN(ActiveScriptControllerUnitTest);
+ DISALLOW_COPY_AND_ASSIGN(ExtensionActionRunnerUnitTest);
};
-ActiveScriptControllerUnitTest::ActiveScriptControllerUnitTest()
+ExtensionActionRunnerUnitTest::ExtensionActionRunnerUnitTest()
: feature_override_(FeatureSwitch::scripts_require_action(),
FeatureSwitch::OVERRIDE_ENABLED),
- active_script_controller_(nullptr) {}
+ extension_action_runner_(nullptr) {}
-ActiveScriptControllerUnitTest::~ActiveScriptControllerUnitTest() {
-}
+ExtensionActionRunnerUnitTest::~ExtensionActionRunnerUnitTest() {}
-const Extension* ActiveScriptControllerUnitTest::AddExtension() {
+const Extension* ExtensionActionRunnerUnitTest::AddExtension() {
const std::string kId = crx_file::id_util::GenerateId("all_hosts_extension");
extension_ =
ExtensionBuilder()
@@ -125,35 +122,35 @@
return extension_.get();
}
-const Extension* ActiveScriptControllerUnitTest::ReloadExtension() {
+const Extension* ExtensionActionRunnerUnitTest::ReloadExtension() {
ExtensionRegistry::Get(profile())->RemoveEnabled(extension_->id());
return AddExtension();
}
-bool ActiveScriptControllerUnitTest::RequiresUserConsent(
+bool ExtensionActionRunnerUnitTest::RequiresUserConsent(
const Extension* extension) const {
PermissionsData::AccessType access_type =
- controller()->RequiresUserConsentForScriptInjectionForTesting(
+ runner()->RequiresUserConsentForScriptInjectionForTesting(
extension, UserScript::PROGRAMMATIC_SCRIPT);
// We should never downright refuse access in these tests.
DCHECK_NE(PermissionsData::ACCESS_DENIED, access_type);
return access_type == PermissionsData::ACCESS_WITHHELD;
}
-void ActiveScriptControllerUnitTest::RequestInjection(
+void ExtensionActionRunnerUnitTest::RequestInjection(
const Extension* extension) {
RequestInjection(extension, UserScript::DOCUMENT_IDLE);
}
-void ActiveScriptControllerUnitTest::RequestInjection(
+void ExtensionActionRunnerUnitTest::RequestInjection(
const Extension* extension,
UserScript::RunLocation run_location) {
- controller()->RequestScriptInjectionForTesting(
+ runner()->RequestScriptInjectionForTesting(
extension, run_location,
GetExecutionCallbackForExtension(extension->id()));
}
-size_t ActiveScriptControllerUnitTest::GetExecutionCountForExtension(
+size_t ExtensionActionRunnerUnitTest::GetExecutionCountForExtension(
const std::string& extension_id) const {
std::map<std::string, int>::const_iterator iter =
extension_executions_.find(extension_id);
@@ -162,21 +159,20 @@
return 0u;
}
-base::Closure ActiveScriptControllerUnitTest::GetExecutionCallbackForExtension(
+base::Closure ExtensionActionRunnerUnitTest::GetExecutionCallbackForExtension(
const std::string& extension_id) {
// We use base unretained here, but if this ever gets executed outside of
// this test's lifetime, we have a major problem anyway.
- return base::Bind(&ActiveScriptControllerUnitTest::IncrementExecutionCount,
- base::Unretained(this),
- extension_id);
+ return base::Bind(&ExtensionActionRunnerUnitTest::IncrementExecutionCount,
+ base::Unretained(this), extension_id);
}
-void ActiveScriptControllerUnitTest::IncrementExecutionCount(
+void ExtensionActionRunnerUnitTest::IncrementExecutionCount(
const std::string& extension_id) {
++extension_executions_[extension_id];
}
-void ActiveScriptControllerUnitTest::SetUp() {
+void ExtensionActionRunnerUnitTest::SetUp() {
ChromeRenderViewHostTestHarness::SetUp();
// Skip syncing for testing purposes.
@@ -187,13 +183,13 @@
TabHelper* tab_helper = TabHelper::FromWebContents(web_contents());
// These should never be null.
DCHECK(tab_helper);
- active_script_controller_ = tab_helper->active_script_controller();
- DCHECK(active_script_controller_);
+ extension_action_runner_ = tab_helper->extension_action_runner();
+ DCHECK(extension_action_runner_);
}
// Test that extensions with all_hosts require permission to execute, and, once
// that permission is granted, do execute.
-TEST_F(ActiveScriptControllerUnitTest, RequestPermissionAndExecute) {
+TEST_F(ExtensionActionRunnerUnitTest, RequestPermissionAndExecute) {
const Extension* extension = AddExtension();
ASSERT_TRUE(extension);
@@ -201,10 +197,9 @@
// Ensure that there aren't any executions pending.
ASSERT_EQ(0u, GetExecutionCountForExtension(extension->id()));
- ASSERT_FALSE(controller()->WantsToRun(extension));
+ ASSERT_FALSE(runner()->WantsToRun(extension));
- ExtensionActionAPI* extension_action_api =
- ExtensionActionAPI::Get(profile());
+ ExtensionActionAPI* extension_action_api = ExtensionActionAPI::Get(profile());
ASSERT_FALSE(extension_action_api->HasBeenBlocked(extension, web_contents()));
// Since the extension requests all_hosts, we should require user consent.
@@ -213,16 +208,16 @@
// Request an injection. The extension should want to run, but should not have
// executed.
RequestInjection(extension);
- EXPECT_TRUE(controller()->WantsToRun(extension));
+ EXPECT_TRUE(runner()->WantsToRun(extension));
EXPECT_TRUE(extension_action_api->HasBeenBlocked(extension, web_contents()));
EXPECT_EQ(0u, GetExecutionCountForExtension(extension->id()));
// Click to accept the extension executing.
- controller()->OnClicked(extension);
+ runner()->OnClicked(extension);
// The extension should execute, and the extension shouldn't want to run.
EXPECT_EQ(1u, GetExecutionCountForExtension(extension->id()));
- EXPECT_FALSE(controller()->WantsToRun(extension));
+ EXPECT_FALSE(runner()->WantsToRun(extension));
EXPECT_FALSE(extension_action_api->HasBeenBlocked(extension, web_contents()));
// Since we already executed on the given page, we shouldn't need permission
@@ -244,9 +239,9 @@
// Grant access.
RequestInjection(extension);
- controller()->OnClicked(extension);
+ runner()->OnClicked(extension);
EXPECT_EQ(2u, GetExecutionCountForExtension(extension->id()));
- EXPECT_FALSE(controller()->WantsToRun(extension));
+ EXPECT_FALSE(runner()->WantsToRun(extension));
// Navigating to another site should also clear the permissions.
NavigateAndCommit(GURL("https://www.foo.com"));
@@ -255,7 +250,7 @@
// Test that injections that are not executed by the time the user navigates are
// ignored and never execute.
-TEST_F(ActiveScriptControllerUnitTest, PendingInjectionsRemovedAtNavigation) {
+TEST_F(ExtensionActionRunnerUnitTest, PendingInjectionsRemovedAtNavigation) {
const Extension* extension = AddExtension();
ASSERT_TRUE(extension);
@@ -265,28 +260,28 @@
// Request an injection. The extension should want to run, but not execute.
RequestInjection(extension);
- EXPECT_TRUE(controller()->WantsToRun(extension));
+ EXPECT_TRUE(runner()->WantsToRun(extension));
EXPECT_EQ(0u, GetExecutionCountForExtension(extension->id()));
// Reload. This should remove the pending injection, and we should not
// execute anything.
Reload();
- EXPECT_FALSE(controller()->WantsToRun(extension));
+ EXPECT_FALSE(runner()->WantsToRun(extension));
EXPECT_EQ(0u, GetExecutionCountForExtension(extension->id()));
// Request and accept a new injection.
RequestInjection(extension);
- controller()->OnClicked(extension);
+ runner()->OnClicked(extension);
// The extension should only have executed once, even though a grand total
// of two executions were requested.
EXPECT_EQ(1u, GetExecutionCountForExtension(extension->id()));
- EXPECT_FALSE(controller()->WantsToRun(extension));
+ EXPECT_FALSE(runner()->WantsToRun(extension));
}
// Test that queueing multiple pending injections, and then accepting, triggers
// them all.
-TEST_F(ActiveScriptControllerUnitTest, MultiplePendingInjection) {
+TEST_F(ExtensionActionRunnerUnitTest, MultiplePendingInjection) {
const Extension* extension = AddExtension();
ASSERT_TRUE(extension);
NavigateAndCommit(GURL("https://www.google.com"));
@@ -300,14 +295,14 @@
EXPECT_EQ(0u, GetExecutionCountForExtension(extension->id()));
- controller()->OnClicked(extension);
+ runner()->OnClicked(extension);
// All pending injections should have executed.
EXPECT_EQ(kNumInjections, GetExecutionCountForExtension(extension->id()));
- EXPECT_FALSE(controller()->WantsToRun(extension));
+ EXPECT_FALSE(runner()->WantsToRun(extension));
}
-TEST_F(ActiveScriptControllerUnitTest, ActiveScriptsUseActiveTabPermissions) {
+TEST_F(ExtensionActionRunnerUnitTest, ActiveScriptsUseActiveTabPermissions) {
const Extension* extension = AddExtension();
NavigateAndCommit(GURL("https://www.google.com"));
@@ -341,7 +336,7 @@
EXPECT_TRUE(RequiresUserConsent(extension));
RequestInjection(extension);
- EXPECT_TRUE(controller()->WantsToRun(extension));
+ EXPECT_TRUE(runner()->WantsToRun(extension));
EXPECT_EQ(0u, GetExecutionCountForExtension(extension->id()));
// Grant active tab.
@@ -350,10 +345,10 @@
// The pending injections should have run since active tab permission was
// granted.
EXPECT_EQ(1u, GetExecutionCountForExtension(extension->id()));
- EXPECT_FALSE(controller()->WantsToRun(extension));
+ EXPECT_FALSE(runner()->WantsToRun(extension));
}
-TEST_F(ActiveScriptControllerUnitTest, ActiveScriptsCanHaveAllUrlsPref) {
+TEST_F(ExtensionActionRunnerUnitTest, ActiveScriptsCanHaveAllUrlsPref) {
const Extension* extension = AddExtension();
ASSERT_TRUE(extension);
@@ -377,7 +372,7 @@
EXPECT_TRUE(RequiresUserConsent(extension));
}
-TEST_F(ActiveScriptControllerUnitTest, TestAlwaysRun) {
+TEST_F(ExtensionActionRunnerUnitTest, TestAlwaysRun) {
const Extension* extension = AddExtension();
ASSERT_TRUE(extension);
@@ -385,24 +380,24 @@
// Ensure that there aren't any executions pending.
ASSERT_EQ(0u, GetExecutionCountForExtension(extension->id()));
- ASSERT_FALSE(controller()->WantsToRun(extension));
+ ASSERT_FALSE(runner()->WantsToRun(extension));
// Since the extension requests all_hosts, we should require user consent.
EXPECT_TRUE(RequiresUserConsent(extension));
// Request an injection. The extension should want to run, but not execute.
RequestInjection(extension);
- EXPECT_TRUE(controller()->WantsToRun(extension));
+ EXPECT_TRUE(runner()->WantsToRun(extension));
EXPECT_EQ(0u, GetExecutionCountForExtension(extension->id()));
// Allow the extension to always run on this origin.
ScriptingPermissionsModifier modifier(profile(), extension);
modifier.GrantHostPermission(web_contents()->GetLastCommittedURL());
- controller()->OnClicked(extension);
+ runner()->OnClicked(extension);
// The extension should execute, and the extension shouldn't want to run.
EXPECT_EQ(1u, GetExecutionCountForExtension(extension->id()));
- EXPECT_FALSE(controller()->WantsToRun(extension));
+ EXPECT_FALSE(runner()->WantsToRun(extension));
// Since we already executed on the given page, we shouldn't need permission
// for a second time.
@@ -436,50 +431,49 @@
EXPECT_FALSE(RequiresUserConsent(extension));
}
-TEST_F(ActiveScriptControllerUnitTest, TestDifferentScriptRunLocations) {
+TEST_F(ExtensionActionRunnerUnitTest, TestDifferentScriptRunLocations) {
const Extension* extension = AddExtension();
ASSERT_TRUE(extension);
NavigateAndCommit(GURL("https://www.foo.com"));
- EXPECT_EQ(BLOCKED_ACTION_NONE, controller()->GetBlockedActions(extension));
+ EXPECT_EQ(BLOCKED_ACTION_NONE, runner()->GetBlockedActions(extension));
RequestInjection(extension, UserScript::DOCUMENT_END);
EXPECT_EQ(BLOCKED_ACTION_SCRIPT_OTHER,
- controller()->GetBlockedActions(extension));
+ runner()->GetBlockedActions(extension));
RequestInjection(extension, UserScript::DOCUMENT_IDLE);
EXPECT_EQ(BLOCKED_ACTION_SCRIPT_OTHER,
- controller()->GetBlockedActions(extension));
+ runner()->GetBlockedActions(extension));
RequestInjection(extension, UserScript::DOCUMENT_START);
EXPECT_EQ(BLOCKED_ACTION_SCRIPT_AT_START | BLOCKED_ACTION_SCRIPT_OTHER,
- controller()->GetBlockedActions(extension));
+ runner()->GetBlockedActions(extension));
- controller()->OnClicked(extension);
- EXPECT_EQ(BLOCKED_ACTION_NONE, controller()->GetBlockedActions(extension));
+ runner()->OnClicked(extension);
+ EXPECT_EQ(BLOCKED_ACTION_NONE, runner()->GetBlockedActions(extension));
}
-TEST_F(ActiveScriptControllerUnitTest, TestWebRequestBlocked) {
+TEST_F(ExtensionActionRunnerUnitTest, TestWebRequestBlocked) {
const Extension* extension = AddExtension();
ASSERT_TRUE(extension);
NavigateAndCommit(GURL("https://www.foo.com"));
- EXPECT_EQ(BLOCKED_ACTION_NONE, controller()->GetBlockedActions(extension));
- EXPECT_FALSE(controller()->WantsToRun(extension));
+ EXPECT_EQ(BLOCKED_ACTION_NONE, runner()->GetBlockedActions(extension));
+ EXPECT_FALSE(runner()->WantsToRun(extension));
- controller()->OnWebRequestBlocked(extension);
- EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST,
- controller()->GetBlockedActions(extension));
- EXPECT_TRUE(controller()->WantsToRun(extension));
+ runner()->OnWebRequestBlocked(extension);
+ EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner()->GetBlockedActions(extension));
+ EXPECT_TRUE(runner()->WantsToRun(extension));
RequestInjection(extension);
EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST | BLOCKED_ACTION_SCRIPT_OTHER,
- controller()->GetBlockedActions(extension));
- EXPECT_TRUE(controller()->WantsToRun(extension));
+ runner()->GetBlockedActions(extension));
+ EXPECT_TRUE(runner()->WantsToRun(extension));
NavigateAndCommit(GURL("https://www.bar.com"));
- EXPECT_EQ(BLOCKED_ACTION_NONE, controller()->GetBlockedActions(extension));
- EXPECT_FALSE(controller()->WantsToRun(extension));
+ EXPECT_EQ(BLOCKED_ACTION_NONE, runner()->GetBlockedActions(extension));
+ EXPECT_FALSE(runner()->WantsToRun(extension));
}
} // namespace extensions
diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc
index 886a927..a4ad4b4 100644
--- a/chrome/browser/extensions/extension_context_menu_model.cc
+++ b/chrome/browser/extensions/extension_context_menu_model.cc
@@ -7,10 +7,10 @@
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/context_menu_matcher.h"
#include "chrome/browser/extensions/extension_action.h"
#include "chrome/browser/extensions/extension_action_manager.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "chrome/browser/extensions/extension_util.h"
@@ -452,10 +452,10 @@
if (command_id == PAGE_ACCESS_RUN_ON_SITE ||
command_id == PAGE_ACCESS_RUN_ON_ALL_SITES) {
- ActiveScriptController* controller =
- ActiveScriptController::GetForWebContents(web_contents);
- if (controller && controller->WantsToRun(extension))
- controller->OnClicked(extension);
+ ExtensionActionRunner* runner =
+ ExtensionActionRunner::GetForWebContents(web_contents);
+ if (runner && runner->WantsToRun(extension))
+ runner->OnClicked(extension);
}
}
diff --git a/chrome/browser/extensions/extension_context_menu_model_unittest.cc b/chrome/browser/extensions/extension_context_menu_model_unittest.cc
index 19951e05..40ae787 100644
--- a/chrome/browser/extensions/extension_context_menu_model_unittest.cc
+++ b/chrome/browser/extensions/extension_context_menu_model_unittest.cc
@@ -9,8 +9,8 @@
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_action_test_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
@@ -513,14 +513,14 @@
content::WebContentsTester::For(contents);
web_contents_tester->NavigateAndCommit(kActiveUrl);
- ActiveScriptController* active_script_controller =
- ActiveScriptController::GetForWebContents(contents);
- ASSERT_TRUE(active_script_controller);
+ ExtensionActionRunner* action_runner =
+ ExtensionActionRunner::GetForWebContents(contents);
+ ASSERT_TRUE(action_runner);
// Pretend the extension wants to run.
int run_count = 0;
base::Closure increment_run_count(base::Bind(&Increment, &run_count));
- active_script_controller->RequestScriptInjectionForTesting(
+ action_runner->RequestScriptInjectionForTesting(
extension, UserScript::DOCUMENT_IDLE, increment_run_count);
ExtensionContextMenuModel menu(extension, GetBrowser(),
@@ -565,7 +565,7 @@
// Since the extension has permission, it should have ran.
EXPECT_EQ(1, run_count);
- EXPECT_FALSE(active_script_controller->WantsToRun(extension));
+ EXPECT_FALSE(action_runner->WantsToRun(extension));
// On another url, the mode should still be run on click.
web_contents_tester->NavigateAndCommit(kOtherUrl);
@@ -580,7 +580,7 @@
EXPECT_FALSE(menu.IsCommandIdChecked(kRunOnAllSites));
// Request another run.
- active_script_controller->RequestScriptInjectionForTesting(
+ action_runner->RequestScriptInjectionForTesting(
extension, UserScript::DOCUMENT_IDLE, increment_run_count);
// Change the mode to be "Run on all sites".
@@ -597,7 +597,7 @@
// It should have ran again.
EXPECT_EQ(2, run_count);
- EXPECT_FALSE(active_script_controller->WantsToRun(extension));
+ EXPECT_FALSE(action_runner->WantsToRun(extension));
// On another url, the mode should also be run on all sites.
web_contents_tester->NavigateAndCommit(kOtherUrl);
@@ -610,7 +610,7 @@
EXPECT_FALSE(menu.IsCommandIdChecked(kRunOnSite));
EXPECT_TRUE(menu.IsCommandIdChecked(kRunOnAllSites));
- active_script_controller->RequestScriptInjectionForTesting(
+ action_runner->RequestScriptInjectionForTesting(
extension, UserScript::DOCUMENT_IDLE, increment_run_count);
// Return the mode to "Run on click".
@@ -626,7 +626,7 @@
// And the extension shouldn't have ran.
EXPECT_EQ(2, run_count);
- EXPECT_TRUE(active_script_controller->WantsToRun(extension));
+ EXPECT_TRUE(action_runner->WantsToRun(extension));
// Install an extension requesting only a single host. Since the extension
// doesn't request all hosts, it shouldn't have withheld permissions, and
diff --git a/chrome/browser/extensions/location_bar_controller.cc b/chrome/browser/extensions/location_bar_controller.cc
index 89af53a5..1c26709 100644
--- a/chrome/browser/extensions/location_bar_controller.cc
+++ b/chrome/browser/extensions/location_bar_controller.cc
@@ -6,9 +6,9 @@
#include <algorithm>
-#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/extension_action_manager.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
@@ -43,14 +43,14 @@
if (!should_show_page_actions_)
return current_actions;
- ActiveScriptController* active_script_controller =
- ActiveScriptController::GetForWebContents(web_contents_);
+ ExtensionActionRunner* action_executor =
+ ExtensionActionRunner::GetForWebContents(web_contents_);
for (const scoped_refptr<const Extension>& extension: extensions) {
// Right now, we can consolidate these actions because we only want to show
// one action per extension. If clicking on an active script action ever
// has a response, then we will need to split the actions.
ExtensionAction* action = action_manager_->GetPageAction(*extension);
- if (!action && active_script_controller->WantsToRun(extension.get())) {
+ if (!action && action_executor->WantsToRun(extension.get())) {
ExtensionActionMap::iterator existing =
active_script_actions_.find(extension->id());
if (existing != active_script_actions_.end()) {
diff --git a/chrome/browser/extensions/location_bar_controller_unittest.cc b/chrome/browser/extensions/location_bar_controller_unittest.cc
index 09c12d28..141db24 100644
--- a/chrome/browser/extensions/location_bar_controller_unittest.cc
+++ b/chrome/browser/extensions/location_bar_controller_unittest.cc
@@ -9,10 +9,10 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "build/build_config.h"
-#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/extension_action.h"
#include "chrome/browser/extensions/extension_action_manager.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/location_bar_controller.h"
#include "chrome/browser/extensions/tab_helper.h"
@@ -126,10 +126,10 @@
// If we request a script injection, then the location bar controller should
// also show a page action for that extension.
- ActiveScriptController* active_script_controller =
- ActiveScriptController::GetForWebContents(web_contents());
- ASSERT_TRUE(active_script_controller);
- active_script_controller->RequestScriptInjectionForTesting(
+ ExtensionActionRunner* action_runner =
+ ExtensionActionRunner::GetForWebContents(web_contents());
+ ASSERT_TRUE(action_runner);
+ action_runner->RequestScriptInjectionForTesting(
no_action, UserScript::DOCUMENT_IDLE, base::Closure());
current_actions = controller->GetCurrentActions();
ASSERT_EQ(2u, current_actions.size());
@@ -141,7 +141,7 @@
// If we request a script injection for an extension that already has a
// page action, only one action should be visible.
- active_script_controller->RequestScriptInjectionForTesting(
+ action_runner->RequestScriptInjectionForTesting(
page_action, UserScript::DOCUMENT_IDLE, base::Closure());
current_actions = controller->GetCurrentActions();
ASSERT_EQ(2u, current_actions.size());
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc
index 07ccc99..253b838 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -9,13 +9,13 @@
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/activity_log/activity_log.h"
#include "chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/api/webstore/webstore_api.h"
#include "chrome/browser/extensions/bookmark_app_helper.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/location_bar_controller.h"
@@ -83,7 +83,7 @@
script_executor_(
new ScriptExecutor(web_contents, &script_execution_observers_)),
location_bar_controller_(new LocationBarController(web_contents)),
- active_script_controller_(new ActiveScriptController(web_contents)),
+ extension_action_runner_(new ExtensionActionRunner(web_contents)),
webstore_inline_installer_factory_(new WebstoreInlineInstallerFactory()),
image_loader_ptr_factory_(this),
weak_ptr_factory_(this) {
diff --git a/chrome/browser/extensions/tab_helper.h b/chrome/browser/extensions/tab_helper.h
index 702bb1c..45de7cf 100644
--- a/chrome/browser/extensions/tab_helper.h
+++ b/chrome/browser/extensions/tab_helper.h
@@ -39,7 +39,7 @@
}
namespace extensions {
-class ActiveScriptController;
+class ExtensionActionRunner;
class BookmarkAppHelper;
class Extension;
class LocationBarController;
@@ -105,8 +105,8 @@
return location_bar_controller_.get();
}
- ActiveScriptController* active_script_controller() {
- return active_script_controller_.get();
+ ExtensionActionRunner* extension_action_runner() {
+ return extension_action_runner_.get();
}
ActiveTabPermissionGranter* active_tab_permission_granter() {
@@ -246,7 +246,7 @@
scoped_ptr<LocationBarController> location_bar_controller_;
- scoped_ptr<ActiveScriptController> active_script_controller_;
+ scoped_ptr<ExtensionActionRunner> extension_action_runner_;
scoped_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_;
diff --git a/chrome/browser/ui/extensions/extension_action_view_controller_unittest.cc b/chrome/browser/ui/extensions/extension_action_view_controller_unittest.cc
index 020dd96..0900274 100644
--- a/chrome/browser/ui/extensions/extension_action_view_controller_unittest.cc
+++ b/chrome/browser/ui/extensions/extension_action_view_controller_unittest.cc
@@ -5,7 +5,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/run_loop.h"
-#include "chrome/browser/extensions/active_script_controller.h"
+#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/ui/extensions/extension_action_view_controller.h"
#include "chrome/browser/ui/extensions/icon_with_badge_image_source.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -129,10 +129,10 @@
EXPECT_FALSE(image_source->paint_page_action_decoration());
EXPECT_FALSE(image_source->paint_blocked_actions_decoration());
- extensions::ActiveScriptController* script_controller =
- extensions::ActiveScriptController::GetForWebContents(web_contents);
- ASSERT_TRUE(script_controller);
- script_controller->RequestScriptInjectionForTesting(
+ extensions::ExtensionActionRunner* action_runner =
+ extensions::ExtensionActionRunner::GetForWebContents(web_contents);
+ ASSERT_TRUE(action_runner);
+ action_runner->RequestScriptInjectionForTesting(
browser_action_ext.get(), extensions::UserScript::DOCUMENT_IDLE,
base::Bind(&base::DoNothing));
image_source =
@@ -141,7 +141,7 @@
EXPECT_FALSE(image_source->paint_page_action_decoration());
EXPECT_TRUE(image_source->paint_blocked_actions_decoration());
- script_controller->OnClicked(browser_action_ext.get());
+ action_runner->OnClicked(browser_action_ext.get());
image_source =
browser_action->GetIconImageSourceForTesting(web_contents, kSize);
EXPECT_FALSE(image_source->grayscale());
@@ -162,7 +162,7 @@
EXPECT_FALSE(image_source->paint_page_action_decoration());
EXPECT_FALSE(image_source->paint_blocked_actions_decoration());
- script_controller->RequestScriptInjectionForTesting(
+ action_runner->RequestScriptInjectionForTesting(
page_action_ext.get(), extensions::UserScript::DOCUMENT_IDLE,
base::Bind(&base::DoNothing));
image_source = page_action->GetIconImageSourceForTesting(web_contents, kSize);
@@ -191,7 +191,7 @@
web_contents, false);
toolbar_model()->SetVisibleIconCount(2u);
- script_controller->OnClicked(page_action_ext.get());
+ action_runner->OnClicked(page_action_ext.get());
image_source = page_action->GetIconImageSourceForTesting(web_contents, kSize);
EXPECT_TRUE(image_source->grayscale());
EXPECT_FALSE(image_source->paint_page_action_decoration());
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index 3c22e8b..70d4471 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -107,8 +107,6 @@
'browser/copresence/chrome_whispernet_config.h',
'browser/extensions/active_install_data.cc',
'browser/extensions/active_install_data.h',
- 'browser/extensions/active_script_controller.cc',
- 'browser/extensions/active_script_controller.h',
'browser/extensions/active_tab_permission_granter.cc',
'browser/extensions/active_tab_permission_granter.h',
'browser/extensions/activity_log/activity_action_constants.cc',
@@ -630,6 +628,8 @@
'browser/extensions/extension_action_icon_factory.h',
'browser/extensions/extension_action_manager.cc',
'browser/extensions/extension_action_manager.h',
+ 'browser/extensions/extension_action_runner.cc',
+ 'browser/extensions/extension_action_runner.h',
'browser/extensions/extension_action_storage_manager.cc',
'browser/extensions/extension_action_storage_manager.h',
'browser/extensions/extension_app_icon_loader.cc',
@@ -670,8 +670,8 @@
'browser/extensions/extension_icon_manager.h',
'browser/extensions/extension_install_checker.cc',
'browser/extensions/extension_install_checker.h',
- 'browser/extensions/extension_install_error_menu_item_id_provider.h',
'browser/extensions/extension_install_error_menu_item_id_provider.cc',
+ 'browser/extensions/extension_install_error_menu_item_id_provider.h',
'browser/extensions/extension_install_prompt.cc',
'browser/extensions/extension_install_prompt.h',
'browser/extensions/extension_install_prompt_show_params.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index a999bf1..29cec21 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -112,7 +112,6 @@
'browser/download/download_started_animation_browsertest.cc',
'browser/download/save_page_browsertest.cc',
'browser/errorpage_browsertest.cc',
- 'browser/extensions/active_script_controller_browsertest.cc',
'browser/extensions/active_tab_apitest.cc',
'browser/extensions/activity_log/activity_log_browsertest.cc',
'browser/extensions/alert_apitest.cc',
@@ -233,6 +232,7 @@
'browser/extensions/error_console/error_console_browsertest.cc',
'browser/extensions/events_apitest.cc',
'browser/extensions/execute_script_apitest.cc',
+ 'browser/extensions/extension_action_runner_browsertest.cc',
'browser/extensions/extension_bindings_apitest.cc',
'browser/extensions/extension_context_menu_browsertest.cc',
'browser/extensions/extension_disabled_ui_browsertest.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 17a8741..5435a2e 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -382,7 +382,6 @@
'browser/apps/app_shim/extension_app_shim_handler_mac_unittest.cc',
'browser/apps/drive/drive_app_mapping_unittest.cc',
'browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc',
- 'browser/extensions/active_script_controller_unittest.cc',
'browser/extensions/active_tab_unittest.cc',
'browser/extensions/activity_log/activity_database_unittest.cc',
'browser/extensions/activity_log/activity_log_enabled_unittest.cc',
@@ -471,6 +470,7 @@
'browser/extensions/event_router_forwarder_unittest.cc',
'browser/extensions/extension_action_icon_factory_unittest.cc',
'browser/extensions/extension_action_manager_unittest.cc',
+ 'browser/extensions/extension_action_runner_unittest.cc',
'browser/extensions/extension_action_unittest.cc',
'browser/extensions/extension_api_unittest.cc',
'browser/extensions/extension_api_unittest.h',
@@ -1338,10 +1338,10 @@
# TODO(tapted): Enable toolkit-views unit_tests on Mac when their
# respective implementations are linked in. http://crbug.com/412234.
'chrome_unit_tests_views_sources': [
+ '../ui/views/controls/webview/webview_unittest.cc',
'browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc',
'browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc',
'browser/ui/views/website_settings/website_settings_popup_view_unittest.cc',
- '../ui/views/controls/webview/webview_unittest.cc',
],
# Views unit_tests for everywhere but ChromeOS.
'chrome_unit_tests_views_non_chromeos_sources': [