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"
11 namespace extensions {
13 class MimeHandlerViewGuestDelegate;
15 class MimeHandlerViewGuest : public GuestView<MimeHandlerViewGuest>,
16 public ExtensionFunctionDispatcher::Delegate {
18 static GuestViewBase* Create(content::BrowserContext* browser_context,
19 int guest_instance_id);
21 static const char Type[];
23 // ExtensionFunctionDispatcher::Delegate implementation.
24 virtual WindowController* GetExtensionWindowController() const OVERRIDE;
25 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE;
27 // GuestViewBase implementation.
28 virtual const char* GetAPINamespace() const OVERRIDE;
29 virtual int GetTaskPrefix() const OVERRIDE;
30 virtual void CreateWebContents(
31 const std::string& embedder_extension_id,
32 int embedder_render_process_id,
33 const GURL& embedder_site_url,
34 const base::DictionaryValue& create_params,
35 const WebContentsCreatedCallback& callback) OVERRIDE;
36 virtual void DidAttachToEmbedder() OVERRIDE;
37 virtual void DidInitialize() OVERRIDE;
39 // WebContentsDelegate implementation.
40 virtual void ContentsZoomChange(bool zoom_in) OVERRIDE;
41 virtual void HandleKeyboardEvent(
42 content::WebContents* source,
43 const content::NativeWebKeyboardEvent& event) OVERRIDE;
45 // content::WebContentsObserver implementation.
46 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
49 MimeHandlerViewGuest(content::BrowserContext* browser_context,
50 int guest_instance_id);
51 virtual ~MimeHandlerViewGuest();
53 void OnRequest(const ExtensionHostMsg_Request_Params& params);
55 scoped_ptr<MimeHandlerViewGuestDelegate> delegate_;
56 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
58 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest);
61 } // namespace extensions
63 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUEST_H_