Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / extensions / browser / guest_view / mime_handler_view / mime_handler_view_guest.h
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.
4
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_
7
8 #include "extensions/browser/extension_function_dispatcher.h"
9 #include "extensions/browser/guest_view/guest_view.h"
10
11 namespace extensions {
12
13 class MimeHandlerViewGuestDelegate;
14
15 class MimeHandlerViewGuest : public GuestView<MimeHandlerViewGuest>,
16                              public ExtensionFunctionDispatcher::Delegate {
17  public:
18   static GuestViewBase* Create(content::BrowserContext* browser_context,
19                                int guest_instance_id);
20
21   static const char Type[];
22
23   // ExtensionFunctionDispatcher::Delegate implementation.
24   virtual WindowController* GetExtensionWindowController() const OVERRIDE;
25   virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE;
26
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;
38
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;
44
45   // content::WebContentsObserver implementation.
46   virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
47
48  private:
49   MimeHandlerViewGuest(content::BrowserContext* browser_context,
50                        int guest_instance_id);
51   virtual ~MimeHandlerViewGuest();
52
53   void OnRequest(const ExtensionHostMsg_Request_Params& params);
54
55   scoped_ptr<MimeHandlerViewGuestDelegate> delegate_;
56   scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
57
58   DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest);
59 };
60
61 }  // namespace extensions
62
63 #endif  // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUEST_H_