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

Unified Diff: chrome/browser/extensions/tab_helper.cc

Issue 270153004: Introduce ActiveScriptController; track active extension scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: UMA Created 6 years, 7 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/tab_helper.cc
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc
index fda6175796dd255c2253775a8135e00c18a55138..bc98823780cff6e438d9e091323db37b026ba4fb 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -9,6 +9,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.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/rules_registry_service.h"
#include "chrome/browser/extensions/api/declarative_content/content_rules_registry.h"
@@ -20,7 +21,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/image_loader.h"
-#include "chrome/browser/extensions/page_action_controller.h"
+#include "chrome/browser/extensions/location_bar_controller.h"
#include "chrome/browser/extensions/script_executor.h"
#include "chrome/browser/extensions/webstore_inline_installer.h"
#include "chrome/browser/extensions/webstore_inline_installer_factory.h"
@@ -103,7 +104,7 @@ TabHelper::TabHelper(content::WebContents* web_contents)
pending_web_app_action_(NONE),
script_executor_(new ScriptExecutor(web_contents,
&script_execution_observers_)),
- location_bar_controller_(new PageActionController(web_contents)),
+ location_bar_controller_(new LocationBarController(web_contents)),
image_loader_ptr_factory_(this),
webstore_inline_installer_factory_(new WebstoreInlineInstallerFactory()) {
// The ActiveTabPermissionManager requires a session ID; ensure this
@@ -307,6 +308,8 @@ bool TabHelper::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_ContentScriptsExecuting,
OnContentScriptsExecuting)
+ IPC_MESSAGE_HANDLER(ExtensionHostMsg_NotifyExtensionScriptExecution,
+ OnNotifyExtensionScriptExecution)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_OnWatchedPageChange,
OnWatchedPageChange)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DetailedConsoleMessageAdded,
@@ -445,6 +448,14 @@ void TabHelper::OnContentScriptsExecuting(
on_url));
}
+void TabHelper::OnNotifyExtensionScriptExecution(
+ const std::string& extension_id) {
+ if (Extension::IdIsValid(extension_id)) {
not at google - send to devlin 2014/05/07 22:49:02 how could this ever be invalid?
Devlin 2014/05/08 18:15:46 IPC defense. Security team requests that, when pa
not at google - send to devlin 2014/05/08 20:47:09 hm ok, I was wondering about that, and it seems li
Devlin 2014/05/08 23:01:00 Done.
+ location_bar_controller()->active_script_controller()
+ ->NotifyScriptExecuting(extension_id);
+ }
+}
+
void TabHelper::OnWatchedPageChange(
const std::vector<std::string>& css_selectors) {
#if defined(ENABLE_EXTENSIONS)

Powered by Google App Engine
This is Rietveld 408576698