OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUEST_
H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUEST_
H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUEST_
H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUEST_
H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "extensions/browser/extension_function_dispatcher.h" | 9 #include "extensions/browser/extension_function_dispatcher.h" |
10 #include "extensions/browser/guest_view/extension_options/extension_options_gues
t_delegate.h" | 10 #include "extensions/browser/guest_view/extension_options/extension_options_gues
t_delegate.h" |
11 #include "extensions/browser/guest_view/guest_view.h" | 11 #include "extensions/browser/guest_view/guest_view.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class BrowserContext; | 15 class BrowserContext; |
16 } | 16 } |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
20 class ExtensionOptionsGuest | 20 class ExtensionOptionsGuest |
21 : public extensions::GuestView<ExtensionOptionsGuest>, | 21 : public extensions::GuestView<ExtensionOptionsGuest>, |
22 public extensions::ExtensionFunctionDispatcher::Delegate { | 22 public extensions::ExtensionFunctionDispatcher::Delegate { |
23 public: | 23 public: |
24 static const char Type[]; | 24 static const char Type[]; |
25 static extensions::GuestViewBase* Create( | 25 static extensions::GuestViewBase* Create( |
26 content::BrowserContext* browser_context, | 26 content::BrowserContext* browser_context, |
27 int guest_instance_id); | 27 int guest_instance_id); |
28 | 28 |
29 // GuestViewBase implementation. | 29 // GuestViewBase implementation. |
30 virtual void CreateWebContents( | 30 void CreateWebContents(const std::string& embedder_extension_id, |
31 const std::string& embedder_extension_id, | 31 int embedder_render_process_id, |
32 int embedder_render_process_id, | 32 const GURL& embedder_site_url, |
33 const GURL& embedder_site_url, | 33 const base::DictionaryValue& create_params, |
34 const base::DictionaryValue& create_params, | 34 const WebContentsCreatedCallback& callback) override; |
35 const WebContentsCreatedCallback& callback) override; | 35 void DidAttachToEmbedder() override; |
36 virtual void DidAttachToEmbedder() override; | 36 void DidInitialize() override; |
37 virtual void DidInitialize() override; | 37 void DidStopLoading() override; |
38 virtual void DidStopLoading() override; | 38 const char* GetAPINamespace() const override; |
39 virtual const char* GetAPINamespace() const override; | 39 int GetTaskPrefix() const override; |
40 virtual int GetTaskPrefix() const override; | 40 void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, |
41 virtual void GuestSizeChangedDueToAutoSize( | 41 const gfx::Size& new_size) override; |
42 const gfx::Size& old_size, | 42 bool IsAutoSizeSupported() const override; |
43 const gfx::Size& new_size) override; | |
44 virtual bool IsAutoSizeSupported() const override; | |
45 | 43 |
46 // ExtensionFunctionDispatcher::Delegate implementation. | 44 // ExtensionFunctionDispatcher::Delegate implementation. |
47 virtual content::WebContents* GetAssociatedWebContents() const override; | 45 content::WebContents* GetAssociatedWebContents() const override; |
48 | 46 |
49 // content::WebContentsDelegate implementation. | 47 // content::WebContentsDelegate implementation. |
50 virtual content::WebContents* OpenURLFromTab( | 48 content::WebContents* OpenURLFromTab( |
51 content::WebContents* source, | 49 content::WebContents* source, |
52 const content::OpenURLParams& params) override; | 50 const content::OpenURLParams& params) override; |
53 virtual void CloseContents(content::WebContents* source) override; | 51 void CloseContents(content::WebContents* source) override; |
54 virtual bool HandleContextMenu( | 52 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
55 const content::ContextMenuParams& params) override; | 53 bool ShouldCreateWebContents( |
56 virtual bool ShouldCreateWebContents( | |
57 content::WebContents* web_contents, | 54 content::WebContents* web_contents, |
58 int route_id, | 55 int route_id, |
59 WindowContainerType window_container_type, | 56 WindowContainerType window_container_type, |
60 const base::string16& frame_name, | 57 const base::string16& frame_name, |
61 const GURL& target_url, | 58 const GURL& target_url, |
62 const std::string& partition_id, | 59 const std::string& partition_id, |
63 content::SessionStorageNamespace* session_storage_namespace) override; | 60 content::SessionStorageNamespace* session_storage_namespace) override; |
64 | 61 |
65 // content::WebContentsObserver implementation. | 62 // content::WebContentsObserver implementation. |
66 virtual bool OnMessageReceived(const IPC::Message& message) override; | 63 bool OnMessageReceived(const IPC::Message& message) override; |
67 | 64 |
68 private: | 65 private: |
69 ExtensionOptionsGuest(content::BrowserContext* browser_context, | 66 ExtensionOptionsGuest(content::BrowserContext* browser_context, |
70 int guest_instance_id); | 67 int guest_instance_id); |
71 virtual ~ExtensionOptionsGuest(); | 68 ~ExtensionOptionsGuest() override; |
72 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 69 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
73 void SetUpAutoSize(); | 70 void SetUpAutoSize(); |
74 | 71 |
75 scoped_ptr<extensions::ExtensionFunctionDispatcher> | 72 scoped_ptr<extensions::ExtensionFunctionDispatcher> |
76 extension_function_dispatcher_; | 73 extension_function_dispatcher_; |
77 scoped_ptr<extensions::ExtensionOptionsGuestDelegate> | 74 scoped_ptr<extensions::ExtensionOptionsGuestDelegate> |
78 extension_options_guest_delegate_; | 75 extension_options_guest_delegate_; |
79 GURL options_page_; | 76 GURL options_page_; |
80 bool has_navigated_; | 77 bool has_navigated_; |
81 | 78 |
82 DISALLOW_COPY_AND_ASSIGN(ExtensionOptionsGuest); | 79 DISALLOW_COPY_AND_ASSIGN(ExtensionOptionsGuest); |
83 }; | 80 }; |
84 | 81 |
85 } // namespace extensions | 82 } // namespace extensions |
86 | 83 |
87 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUE
ST_H_ | 84 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUE
ST_H_ |
OLD | NEW |