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

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

Issue 567037: Initial work on making extensions work in incognito mode. (Closed)
Patch Set: added experimental requirement Created 10 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
« no previous file with comments | « chrome/browser/extensions/user_script_master.h ('k') | chrome/browser/gtk/browser_actions_toolbar_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/user_script_master.cc
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 3478b683191d88c0dc64c67d5f27a7790090f476..a7d69f60e78758b069d27590effd2fe833a869d5 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -16,6 +16,7 @@
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extensions_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/url_constants.h"
@@ -333,17 +334,15 @@ void UserScriptMaster::Observe(NotificationType type,
StartScan();
break;
case NotificationType::EXTENSION_LOADED: {
- // TODO(aa): Fix race here. A page could need a content script on startup,
- // before the extension has loaded. We need to freeze the renderer in
- // that case.
- // See: http://code.google.com/p/chromium/issues/detail?id=11547.
-
// Add any content scripts inside the extension.
Extension* extension = Details<Extension>(details).ptr();
+ bool incognito_enabled = profile_->GetExtensionsService()->
+ IsIncognitoEnabled(extension->id());
const UserScriptList& scripts = extension->content_scripts();
for (UserScriptList::const_iterator iter = scripts.begin();
iter != scripts.end(); ++iter) {
lone_scripts_.push_back(*iter);
+ lone_scripts_.back().set_incognito_enabled(incognito_enabled);
}
if (extensions_service_ready_)
StartScan();
@@ -379,3 +378,14 @@ void UserScriptMaster::StartScan() {
script_reloader_->StartScan(user_script_dir_, lone_scripts_);
}
+
+void UserScriptMaster::ReloadExtensionForTesting(Extension* extension) {
+ bool incognito_enabled = profile_->GetExtensionsService()->
+ IsIncognitoEnabled(extension->id());
+ for (UserScriptList::iterator iter = lone_scripts_.begin();
+ iter != lone_scripts_.end(); ++iter) {
+ if (iter->extension_id() == extension->id())
+ (*iter).set_incognito_enabled(incognito_enabled);
+ }
+ StartScan();
+}
« no previous file with comments | « chrome/browser/extensions/user_script_master.h ('k') | chrome/browser/gtk/browser_actions_toolbar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698