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

Unified Diff: chrome/browser/extensions/api/messaging/message_service.cc

Issue 2766263003: Extensions: Only load incognito-enabled extensions in an incognito renderer. (Closed)
Patch Set: -- Created 3 years, 9 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/messaging/message_service.cc
diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc
index 44ce1f03e74791fd9be07d4d5f58d3ff494b9395..a10c3079672b754d92ffe42f02ddae3f630365e8 100644
--- a/chrome/browser/extensions/api/messaging/message_service.cc
+++ b/chrome/browser/extensions/api/messaging/message_service.cc
@@ -327,16 +327,18 @@ void MessageService::OpenChannelToExtension(
PendingMessagesQueue();
if (context->IsOffTheRecord() &&
!util::IsIncognitoEnabled(target_extension_id, context)) {
+ // The extension is not enabled in incognito mode. However it is loaded in
+ // the associated incognito renderer process. This can only happen when the
+ // extension can't be enabled in incognito mode. This can include platform
+ // apps, component extensions and extensions which are not allowed in the
+ // incognito mode.
+ DCHECK(!util::CanBeIncognitoEnabled(target_extension));
karandeepb 2017/03/23 02:54:03 At least in this case, CanBeIncognitoEnabled seems
Devlin 2017/03/23 22:08:36 Is this check correct? What about the case of a w
Devlin 2017/03/23 22:08:36 I'm not sure I love SupportsIncognitoToggle, since
karandeepb 2017/04/04 03:44:15 It isn't. I had misunderstood what was happening.
karandeepb 2017/04/04 03:44:15 The current naming SGTM then.
+
// Give the user a chance to accept an incognito connection from the web if
- // they haven't already, with the conditions:
- // - Only for spanning-mode incognito. We don't want the complication of
- // spinning up an additional process here which might need to do some
- // setup that we're not expecting.
- // - Only for extensions that can't normally be enabled in incognito, since
- // that surface (e.g. chrome://extensions) should be the only one for
- // enabling in incognito. In practice this means platform apps only.
- if (!is_web_connection || IncognitoInfo::IsSplitMode(target_extension) ||
- util::CanBeIncognitoEnabled(target_extension)) {
+ // they haven't already. But don't do this for split mode incognito. We
+ // don't want the complication of spinning up an additional process here
+ // which might need to do some setup that we're not expecting.
+ if (!is_web_connection || IncognitoInfo::IsSplitMode(target_extension)) {
OnOpenChannelAllowed(std::move(params), false);
return;
}

Powered by Google App Engine
This is Rietveld 408576698