1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUEST_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUEST_H_
8 #include "extensions/browser/extension_function_dispatcher.h"
9 #include "extensions/browser/guest_view/guest_view.h"
13 struct ContextMenuParams
;
14 } // namespace content
16 namespace extensions
{
18 class MimeHandlerViewGuestDelegate
;
20 class MimeHandlerViewGuest
: public GuestView
<MimeHandlerViewGuest
>,
21 public ExtensionFunctionDispatcher::Delegate
{
23 static GuestViewBase
* Create(content::BrowserContext
* browser_context
,
24 content::WebContents
* owner_web_contents
,
25 int guest_instance_id
);
27 static const char Type
[];
29 // ExtensionFunctionDispatcher::Delegate implementation.
30 WindowController
* GetExtensionWindowController() const override
;
31 content::WebContents
* GetAssociatedWebContents() const override
;
33 // GuestViewBase implementation.
34 const char* GetAPINamespace() const override
;
35 int GetTaskPrefix() const override
;
36 void CreateWebContents(const base::DictionaryValue
& create_params
,
37 const WebContentsCreatedCallback
& callback
) override
;
38 void DidAttachToEmbedder() override
;
39 void DidInitialize(const base::DictionaryValue
& create_params
) override
;
40 bool ZoomPropagatesFromEmbedderToGuest() const override
;
42 // content::BrowserPluginGuestDelegate implementation
43 bool Find(int request_id
,
44 const base::string16
& search_text
,
45 const blink::WebFindOptions
& options
) override
;
47 // WebContentsDelegate implementation.
48 content::WebContents
* OpenURLFromTab(
49 content::WebContents
* source
,
50 const content::OpenURLParams
& params
) override
;
51 bool HandleContextMenu(const content::ContextMenuParams
& params
) override
;
52 void HandleKeyboardEvent(
53 content::WebContents
* source
,
54 const content::NativeWebKeyboardEvent
& event
) override
;
55 void FindReply(content::WebContents
* web_contents
,
57 int number_of_matches
,
58 const gfx::Rect
& selection_rect
,
59 int active_match_ordinal
,
60 bool final_update
) override
;
61 bool SaveFrame(const GURL
& url
, const content::Referrer
& referrer
) override
;
63 // content::WebContentsObserver implementation.
64 void DocumentOnLoadCompletedInMainFrame() override
;
65 bool OnMessageReceived(const IPC::Message
& message
) override
;
68 MimeHandlerViewGuest(content::BrowserContext
* browser_context
,
69 content::WebContents
* owner_web_contents
,
70 int guest_instance_id
);
71 ~MimeHandlerViewGuest() override
;
73 void OnRequest(const ExtensionHostMsg_Request_Params
& params
);
75 scoped_ptr
<MimeHandlerViewGuestDelegate
> delegate_
;
76 scoped_ptr
<ExtensionFunctionDispatcher
> extension_function_dispatcher_
;
79 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest
);
82 } // namespace extensions
84 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUEST_H_