Chromium Code Reviews| Index: extensions/renderer/dispatcher.cc |
| diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc |
| index 34324e2be1bf10a27c375337e720fd03c5a85029..943522b276e03895ee7a77e931875d85061b248a 100644 |
| --- a/extensions/renderer/dispatcher.cc |
| +++ b/extensions/renderer/dispatcher.cc |
| @@ -221,6 +221,9 @@ class ServiceWorkerScriptContextSet { |
| base::LazyInstance<ServiceWorkerScriptContextSet> |
| g_service_worker_script_context_set = LAZY_INSTANCE_INITIALIZER; |
| +base::LazyInstance<std::string> webview_partition_id = |
| + LAZY_INSTANCE_INITIALIZER; |
|
not at google - send to devlin
2015/08/31 21:52:51
This can be a member of Dispatcher, and note that
paulmeyer
2015/09/02 13:43:57
Done.
|
| + |
| } // namespace |
| Dispatcher::Dispatcher(DispatcherDelegate* delegate) |
| @@ -825,6 +828,11 @@ void Dispatcher::RegisterNativeHandlers(ModuleSystem* module_system, |
| "runtime", scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context))); |
| } |
| +// static |
| +std::string Dispatcher::GetWebViewPartitionID() { |
| + return webview_partition_id.Get(); |
| +} |
| + |
| bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) { |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(Dispatcher, message) |
| @@ -840,6 +848,8 @@ bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) { |
| IPC_MESSAGE_HANDLER(ExtensionMsg_SetScriptingWhitelist, |
| OnSetScriptingWhitelist) |
| IPC_MESSAGE_HANDLER(ExtensionMsg_SetSystemFont, OnSetSystemFont) |
| + IPC_MESSAGE_HANDLER(ExtensionMsg_SetWebViewPartitionID, |
| + OnSetWebViewPartitionID) |
| IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend) |
| IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend) |
| IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs) |
| @@ -1054,6 +1064,14 @@ void Dispatcher::OnSetSystemFont(const std::string& font_family, |
| system_font_size_ = font_size; |
| } |
| +void Dispatcher::OnSetWebViewPartitionID(const std::string& partition_id) { |
| + // |webview_partition_id| cannot be changed once set. |
| + std::string& stored_id = webview_partition_id.Get(); |
| + DCHECK(stored_id.empty() || stored_id == partition_id); |
| + if (stored_id.empty()) |
| + stored_id = partition_id; |
| +} |
| + |
| void Dispatcher::OnShouldSuspend(const std::string& extension_id, |
| uint64 sequence_id) { |
| RenderThread::Get()->Send( |