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

Unified Diff: extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc

Issue 597653002: Make extension APIs work in MimeHandlerView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@work-pdf-zoom2-dbg
Patch Set: Created 6 years, 3 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 | « extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
index 9e094127a7a6b1a0f3017dd1bdc6a2426422b2ff..2a84e0410648b9aea0f0fd41af4d3fba91fcaabf 100644
--- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
+++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
@@ -14,9 +14,11 @@
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_constants.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h"
#include "extensions/browser/process_manager.h"
+#include "extensions/common/extension_messages.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/guest_view/guest_view_constants.h"
#include "extensions/strings/grit/extensions_strings.h"
+#include "ipc/ipc_message_macros.h"
#include "net/base/url_util.h"
using content::WebContents;
@@ -47,6 +49,14 @@ MimeHandlerViewGuest::MimeHandlerViewGuest(
MimeHandlerViewGuest::~MimeHandlerViewGuest() {
}
+WindowController* MimeHandlerViewGuest::GetExtensionWindowController() const {
+ return NULL;
+}
+
+WebContents* MimeHandlerViewGuest::GetAssociatedWebContents() const {
+ return web_contents();
+}
+
const char* MimeHandlerViewGuest::GetAPINamespace() const {
return "mimeHandlerViewGuestInternal";
}
@@ -114,6 +124,8 @@ void MimeHandlerViewGuest::DidAttachToEmbedder() {
}
void MimeHandlerViewGuest::DidInitialize() {
+ extension_function_dispatcher_.reset(
+ new ExtensionFunctionDispatcher(browser_context(), this));
if (delegate_)
delegate_->AttachHelpers();
}
@@ -134,4 +146,21 @@ void MimeHandlerViewGuest::HandleKeyboardEvent(
event);
}
+bool MimeHandlerViewGuest::OnMessageReceived(const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewGuest, message)
+ IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void MimeHandlerViewGuest::OnRequest(
+ const ExtensionHostMsg_Request_Params& params) {
+ if (extension_function_dispatcher_) {
+ extension_function_dispatcher_->Dispatch(
+ params, web_contents()->GetRenderViewHost());
+ }
+}
+
} // namespace extensions
« no previous file with comments | « extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698