Index: extensions/browser/guest_view/extensions_guest_view_message_filter.cc |
diff --git a/extensions/browser/guest_view/guest_view_message_filter.cc b/extensions/browser/guest_view/extensions_guest_view_message_filter.cc |
similarity index 66% |
copy from extensions/browser/guest_view/guest_view_message_filter.cc |
copy to extensions/browser/guest_view/extensions_guest_view_message_filter.cc |
index 7f43a3ed9a977f263611b97af4acc8e9614afd0e..215bf816af4b2187607f1edd7445604caaf8a230 100644 |
--- a/extensions/browser/guest_view/guest_view_message_filter.cc |
+++ b/extensions/browser/guest_view/extensions_guest_view_message_filter.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "extensions/browser/guest_view/guest_view_message_filter.h" |
+#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/render_frame_host.h" |
@@ -15,7 +15,7 @@ |
#include "extensions/browser/guest_view/web_view/web_view_content_script_manager.h" |
#include "extensions/browser/guest_view/web_view/web_view_guest.h" |
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
-#include "extensions/common/guest_view/guest_view_messages.h" |
+#include "extensions/common/guest_view/extensions_guest_view_messages.h" |
#include "ipc/ipc_message_macros.h" |
using content::BrowserContext; |
@@ -25,26 +25,26 @@ using content::WebContents; |
namespace extensions { |
-GuestViewMessageFilter::GuestViewMessageFilter(int render_process_id, |
- BrowserContext* context) |
- : BrowserMessageFilter(GuestViewMsgStart), |
+ExtensionsGuestViewMessageFilter::ExtensionsGuestViewMessageFilter( |
+ int render_process_id, |
+ BrowserContext* context) |
+ : BrowserMessageFilter(ExtensionsGuestViewMsgStart), |
render_process_id_(render_process_id), |
browser_context_(context), |
weak_ptr_factory_(this) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
} |
-GuestViewMessageFilter::~GuestViewMessageFilter() { |
+ExtensionsGuestViewMessageFilter::~ExtensionsGuestViewMessageFilter() { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
} |
-void GuestViewMessageFilter::OverrideThreadForMessage( |
+void ExtensionsGuestViewMessageFilter::OverrideThreadForMessage( |
const IPC::Message& message, |
BrowserThread::ID* thread) { |
switch (message.type()) { |
- case GuestViewHostMsg_AttachGuest::ID: |
- case GuestViewHostMsg_CreateMimeHandlerViewGuest::ID: |
- case GuestViewHostMsg_ResizeGuest::ID: |
+ case ExtensionsGuestViewHostMsg_CreateMimeHandlerViewGuest::ID: |
+ case ExtensionsGuestViewHostMsg_ResizeGuest::ID: |
*thread = BrowserThread::UI; |
break; |
default: |
@@ -52,45 +52,39 @@ void GuestViewMessageFilter::OverrideThreadForMessage( |
} |
} |
-void GuestViewMessageFilter::OnDestruct() const { |
+void ExtensionsGuestViewMessageFilter::OnDestruct() const { |
// Destroy the filter on the IO thread since that's where its weak pointers |
// are being used. |
BrowserThread::DeleteOnIOThread::Destruct(this); |
} |
-bool GuestViewMessageFilter::OnMessageReceived(const IPC::Message& message) { |
+bool ExtensionsGuestViewMessageFilter::OnMessageReceived( |
+ const IPC::Message& message) { |
bool handled = true; |
- IPC_BEGIN_MESSAGE_MAP(GuestViewMessageFilter, message) |
- IPC_MESSAGE_HANDLER(GuestViewHostMsg_AttachGuest, OnAttachGuest) |
- IPC_MESSAGE_HANDLER(GuestViewHostMsg_CreateMimeHandlerViewGuest, |
- OnCreateMimeHandlerViewGuest) |
- IPC_MESSAGE_HANDLER(GuestViewHostMsg_ResizeGuest, OnResizeGuest) |
- IPC_MESSAGE_HANDLER(GuestViewHostMsg_CanExecuteContentScriptSync, |
+ IPC_BEGIN_MESSAGE_MAP(ExtensionsGuestViewMessageFilter, message) |
+ IPC_MESSAGE_HANDLER(ExtensionsGuestViewHostMsg_CanExecuteContentScriptSync, |
OnCanExecuteContentScript) |
+ IPC_MESSAGE_HANDLER(ExtensionsGuestViewHostMsg_CreateMimeHandlerViewGuest, |
+ OnCreateMimeHandlerViewGuest) |
+ IPC_MESSAGE_HANDLER(ExtensionsGuestViewHostMsg_ResizeGuest, OnResizeGuest) |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
return handled; |
} |
-void GuestViewMessageFilter::OnAttachGuest( |
- int element_instance_id, |
- int guest_instance_id, |
- const base::DictionaryValue& params) { |
- DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- auto manager = |
- GuestViewManager::FromBrowserContextIfAvailable(browser_context_); |
- // We should have a GuestViewManager at this point. If we don't then the |
- // embedder is misbehaving. |
- if (!manager) |
- return; |
+void ExtensionsGuestViewMessageFilter::OnCanExecuteContentScript( |
+ int render_view_id, |
+ int script_id, |
+ bool* allowed) { |
+ WebViewRendererState::WebViewInfo info; |
+ WebViewRendererState::GetInstance()->GetInfo(render_process_id_, |
+ render_view_id, &info); |
- manager->AttachGuest(render_process_id_, |
- element_instance_id, |
- guest_instance_id, |
- params); |
+ *allowed = |
+ info.content_script_ids.find(script_id) != info.content_script_ids.end(); |
} |
-void GuestViewMessageFilter::OnCreateMimeHandlerViewGuest( |
+void ExtensionsGuestViewMessageFilter::OnCreateMimeHandlerViewGuest( |
int render_frame_id, |
const std::string& view_id, |
int element_instance_id, |
@@ -107,12 +101,14 @@ void GuestViewMessageFilter::OnCreateMimeHandlerViewGuest( |
return; |
GuestViewManager::WebContentsCreatedCallback callback = |
- base::Bind(&GuestViewMessageFilter::MimeHandlerViewGuestCreatedCallback, |
- this, |
- element_instance_id, |
- render_process_id_, |
- render_frame_id, |
- element_size); |
+ base::Bind( |
+ &ExtensionsGuestViewMessageFilter:: |
+ MimeHandlerViewGuestCreatedCallback, |
+ this, |
+ element_instance_id, |
+ render_process_id_, |
+ render_frame_id, |
+ element_size); |
base::DictionaryValue create_params; |
create_params.SetString(mime_handler_view::kViewId, view_id); |
@@ -124,9 +120,10 @@ void GuestViewMessageFilter::OnCreateMimeHandlerViewGuest( |
callback); |
} |
-void GuestViewMessageFilter::OnResizeGuest(int render_frame_id, |
- int element_instance_id, |
- const gfx::Size& new_size) { |
+void ExtensionsGuestViewMessageFilter::OnResizeGuest( |
+ int render_frame_id, |
+ int element_instance_id, |
+ const gfx::Size& new_size) { |
auto manager = |
GuestViewManager::FromBrowserContextIfAvailable(browser_context_); |
// We should have a GuestViewManager at this point. If we don't then the |
@@ -146,18 +143,7 @@ void GuestViewMessageFilter::OnResizeGuest(int render_frame_id, |
mhvg->SetSize(set_size_params); |
} |
-void GuestViewMessageFilter::OnCanExecuteContentScript(int render_view_id, |
- int script_id, |
- bool* allowed) { |
- WebViewRendererState::WebViewInfo info; |
- WebViewRendererState::GetInstance()->GetInfo(render_process_id_, |
- render_view_id, &info); |
- |
- *allowed = |
- info.content_script_ids.find(script_id) != info.content_script_ids.end(); |
-} |
- |
-void GuestViewMessageFilter::MimeHandlerViewGuestCreatedCallback( |
+void ExtensionsGuestViewMessageFilter::MimeHandlerViewGuestCreatedCallback( |
int element_instance_id, |
int embedder_render_process_id, |
int embedder_render_frame_id, |
@@ -185,7 +171,8 @@ void GuestViewMessageFilter::MimeHandlerViewGuestCreatedCallback( |
attach_params); |
rfh->Send( |
- new GuestViewMsg_CreateMimeHandlerViewGuestACK(element_instance_id)); |
+ new ExtensionsGuestViewMsg_CreateMimeHandlerViewGuestACK( |
+ element_instance_id)); |
} |
} // namespace extensions |