| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_VIEW_EXTENSION_VIEW_GUEST_H_ |
| 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUEST_
H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_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_view/extension_view_guest_dele
gate.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 ExtensionViewGuest |
| 21 : public extensions::GuestView<ExtensionOptionsGuest>, | 21 : public extensions::GuestView<ExtensionViewGuest>, |
| 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::WebContents* owner_web_contents, | 26 content::WebContents* owner_web_contents, |
| 27 int guest_instance_id); | 27 int guest_instance_id); |
| 28 | 28 |
| 29 // Request navigating the guest to the provided |src| URL. |
| 30 void NavigateGuest(const std::string& src, bool force_navigation); |
| 31 |
| 29 // GuestViewBase implementation. | 32 // GuestViewBase implementation. |
| 30 bool CanRunInDetachedState() const override; | |
| 31 void CreateWebContents(const base::DictionaryValue& create_params, | 33 void CreateWebContents(const base::DictionaryValue& create_params, |
| 32 const WebContentsCreatedCallback& callback) override; | 34 const WebContentsCreatedCallback& callback) override; |
| 35 void DidAttachToEmbedder() override; |
| 33 void DidInitialize(const base::DictionaryValue& create_params) override; | 36 void DidInitialize(const base::DictionaryValue& create_params) override; |
| 34 void DidStopLoading() override; | |
| 35 const char* GetAPINamespace() const override; | 37 const char* GetAPINamespace() const override; |
| 36 int GetTaskPrefix() const override; | 38 int GetTaskPrefix() const override; |
| 37 void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, | |
| 38 const gfx::Size& new_size) override; | |
| 39 bool IsAutoSizeSupported() const override; | |
| 40 bool IsPreferredSizeModeEnabled() const override; | |
| 41 void OnPreferredSizeChanged(const gfx::Size& pref_size) override; | |
| 42 | 39 |
| 43 // ExtensionFunctionDispatcher::Delegate implementation. | 40 // ExtensionFunctionDispatcher::Delegate implementation. |
| 44 content::WebContents* GetAssociatedWebContents() const override; | 41 content::WebContents* GetAssociatedWebContents() const override; |
| 45 | 42 |
| 46 // content::WebContentsDelegate implementation. | 43 // content::WebContentsDelegate implementation. |
| 47 content::WebContents* OpenURLFromTab( | 44 content::WebContents* OpenURLFromTab( |
| 48 content::WebContents* source, | 45 content::WebContents* source, |
| 49 const content::OpenURLParams& params) override; | 46 const content::OpenURLParams& params) override; |
| 50 void CloseContents(content::WebContents* source) override; | |
| 51 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 47 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 52 bool ShouldCreateWebContents( | 48 bool ShouldCreateWebContents( |
| 53 content::WebContents* web_contents, | 49 content::WebContents* web_contents, |
| 54 int route_id, | 50 int route_id, |
| 55 int main_frame_route_id, | 51 int main_frame_route_id, |
| 56 WindowContainerType window_container_type, | 52 WindowContainerType window_container_type, |
| 57 const base::string16& frame_name, | 53 const base::string16& frame_name, |
| 58 const GURL& target_url, | 54 const GURL& target_url, |
| 59 const std::string& partition_id, | 55 const std::string& partition_id, |
| 60 content::SessionStorageNamespace* session_storage_namespace) override; | 56 content::SessionStorageNamespace* session_storage_namespace) override; |
| 61 | 57 |
| 62 // content::WebContentsObserver implementation. | 58 // content::WebContentsObserver implementation. |
| 63 void DidNavigateMainFrame( | 59 void DidNavigateMainFrame( |
| 64 const content::LoadCommittedDetails& details, | 60 const content::LoadCommittedDetails& details, |
| 65 const content::FrameNavigateParams& params) override; | 61 const content::FrameNavigateParams& params) override; |
| 66 bool OnMessageReceived(const IPC::Message& message) override; | 62 bool OnMessageReceived(const IPC::Message& message) override; |
| 67 | 63 |
| 68 private: | 64 private: |
| 69 ExtensionOptionsGuest(content::WebContents* owner_web_contents, | 65 ExtensionViewGuest(content::WebContents* owner_web_contents, |
| 70 int guest_instance_id); | 66 int guest_instance_id); |
| 71 ~ExtensionOptionsGuest() override; | 67 ~ExtensionViewGuest() override; |
| 72 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 68 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
| 73 | 69 |
| 70 // TODO(apacible): Apply all attributes. |
| 71 // Applies src attribute to the extensionview. |
| 72 void ApplySrc(const base::DictionaryValue& params); |
| 73 |
| 74 scoped_ptr<extensions::ExtensionFunctionDispatcher> | 74 scoped_ptr<extensions::ExtensionFunctionDispatcher> |
| 75 extension_function_dispatcher_; | 75 extension_function_dispatcher_; |
| 76 scoped_ptr<extensions::ExtensionOptionsGuestDelegate> | 76 scoped_ptr<extensions::ExtensionViewGuestDelegate> |
| 77 extension_options_guest_delegate_; | 77 extension_view_guest_delegate_; |
| 78 GURL options_page_; | 78 GURL view_page_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(ExtensionOptionsGuest); | 80 DISALLOW_COPY_AND_ASSIGN(ExtensionViewGuest); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace extensions | 83 } // namespace extensions |
| 84 | 84 |
| 85 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUE
ST_H_ | 85 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_ |
| OLD | NEW |