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

Side by Side Diff: chrome/browser/extensions/api/messaging/message_service.cc

Issue 2766263003: Extensions: Only load incognito-enabled extensions in an incognito renderer. (Closed)
Patch Set: Address review Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/messaging/message_service.h" 5 #include "chrome/browser/extensions/api/messaging/message_service.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 source_frame_id, nullptr, receiver_port_id, source_extension_id, 322 source_frame_id, nullptr, receiver_port_id, source_extension_id,
323 target_extension_id, source_url, channel_name, include_tls_channel_id, 323 target_extension_id, source_url, channel_name, include_tls_channel_id,
324 include_guest_process_info)); 324 include_guest_process_info));
325 325
326 pending_incognito_channels_[params->receiver_port_id.GetChannelId()] = 326 pending_incognito_channels_[params->receiver_port_id.GetChannelId()] =
327 PendingMessagesQueue(); 327 PendingMessagesQueue();
328 if (context->IsOffTheRecord() && 328 if (context->IsOffTheRecord() &&
329 !util::IsIncognitoEnabled(target_extension_id, context)) { 329 !util::IsIncognitoEnabled(target_extension_id, context)) {
330 // Give the user a chance to accept an incognito connection from the web if 330 // Give the user a chance to accept an incognito connection from the web if
331 // they haven't already, with the conditions: 331 // they haven't already, with the conditions:
332 // - Only for spanning-mode incognito. We don't want the complication of 332 // - Only for non-split mode incognito. We don't want the complication of
333 // spinning up an additional process here which might need to do some 333 // spinning up an additional process here which might need to do some
334 // setup that we're not expecting. 334 // setup that we're not expecting.
335 // - Only for extensions that can't normally be enabled in incognito, since 335 // - Only for extensions that can't normally be enabled in incognito, since
336 // that surface (e.g. chrome://extensions) should be the only one for 336 // that surface (e.g. chrome://extensions) should be the only one for
337 // enabling in incognito. In practice this means platform apps only. 337 // enabling in incognito. In practice this means platform apps only.
338 if (!is_web_connection || IncognitoInfo::IsSplitMode(target_extension) || 338 if (!is_web_connection || IncognitoInfo::IsSplitMode(target_extension) ||
339 util::CanBeIncognitoEnabled(target_extension)) { 339 util::CanBeIncognitoEnabled(target_extension)) {
340 OnOpenChannelAllowed(std::move(params), false); 340 OnOpenChannelAllowed(std::move(params), false);
341 return; 341 return;
342 } 342 }
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 MessageChannelMap::iterator channel_iter = channels_.find(channel_id); 987 MessageChannelMap::iterator channel_iter = channels_.find(channel_id);
988 if (channel_iter != channels_.end()) { 988 if (channel_iter != channels_.end()) {
989 for (const PendingMessage& message : queue) { 989 for (const PendingMessage& message : queue) {
990 DispatchMessage(message.first, channel_iter->second.get(), 990 DispatchMessage(message.first, channel_iter->second.get(),
991 message.second); 991 message.second);
992 } 992 }
993 } 993 }
994 } 994 }
995 995
996 } // namespace extensions 996 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698