| OLD | NEW |
| 1 // Copyright 2015 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_VIEW_EXTENSION_VIEW_GUEST_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_ |
| 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_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 "components/guest_view/browser/guest_view.h" | 9 #include "components/guest_view/browser/guest_view.h" |
| 10 #include "extensions/browser/extension_function_dispatcher.h" | 10 #include "extensions/browser/extension_function_dispatcher.h" |
| 11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class BrowserContext; | 14 class BrowserContext; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 class ExtensionViewGuest | 19 class ExtensionViewGuest |
| 20 : public guest_view::GuestView<ExtensionViewGuest> { | 20 : public guest_view::GuestView<ExtensionViewGuest> { |
| 21 public: | 21 public: |
| 22 static const char Type[]; | 22 static const char Type[]; |
| 23 static guest_view::GuestViewBase* Create( | 23 static guest_view::GuestViewBase* Create( |
| 24 content::WebContents* owner_web_contents); | 24 content::WebContents* owner_web_contents); |
| 25 | 25 |
| 26 // Request navigating the guest to the provided |src| URL. | 26 // Request navigating the guest to the provided |src| URL. |
| 27 // Returns true if the navigation is successful. | 27 // Returns true if the navigation is successful. |
| 28 bool NavigateGuest(const std::string& src, bool force_navigation); | 28 bool NavigateGuest(const std::string& src, bool force_navigation); |
| 29 | 29 |
| 30 private: |
| 31 ExtensionViewGuest(content::WebContents* owner_web_contents); |
| 32 ~ExtensionViewGuest() override; |
| 33 |
| 30 // GuestViewBase implementation. | 34 // GuestViewBase implementation. |
| 31 bool CanRunInDetachedState() const override; | 35 bool CanRunInDetachedState() const final; |
| 32 void CreateWebContents(const base::DictionaryValue& create_params, | 36 void CreateWebContents(const base::DictionaryValue& create_params, |
| 33 const WebContentsCreatedCallback& callback) override; | 37 const WebContentsCreatedCallback& callback) final; |
| 34 void DidInitialize(const base::DictionaryValue& create_params) override; | 38 void DidInitialize(const base::DictionaryValue& create_params) final; |
| 35 void DidAttachToEmbedder() override; | 39 void DidAttachToEmbedder() final; |
| 36 const char* GetAPINamespace() const override; | 40 const char* GetAPINamespace() const final; |
| 37 int GetTaskPrefix() const override; | 41 int GetTaskPrefix() const final; |
| 38 | 42 |
| 39 // content::WebContentsObserver implementation. | 43 // content::WebContentsObserver implementation. |
| 40 void DidCommitProvisionalLoadForFrame( | 44 void DidCommitProvisionalLoadForFrame( |
| 41 content::RenderFrameHost* render_frame_host, | 45 content::RenderFrameHost* render_frame_host, |
| 42 const GURL& url, | 46 const GURL& url, |
| 43 ui::PageTransition transition_type) override; | 47 ui::PageTransition transition_type) final; |
| 44 void DidNavigateMainFrame( | 48 void DidNavigateMainFrame(const content::LoadCommittedDetails& details, |
| 45 const content::LoadCommittedDetails& details, | 49 const content::FrameNavigateParams& params) final; |
| 46 const content::FrameNavigateParams& params) override; | |
| 47 | |
| 48 private: | |
| 49 ExtensionViewGuest(content::WebContents* owner_web_contents); | |
| 50 ~ExtensionViewGuest() override; | |
| 51 | 50 |
| 52 // Applies attributes to the extensionview. | 51 // Applies attributes to the extensionview. |
| 53 void ApplyAttributes(const base::DictionaryValue& params); | 52 void ApplyAttributes(const base::DictionaryValue& params); |
| 54 | 53 |
| 55 // The full URL that the extensionview is currently navigated to. | 54 // The full URL that the extensionview is currently navigated to. |
| 56 GURL url_; | 55 GURL url_; |
| 57 | 56 |
| 58 // The extension URL, including the extension scheme and extension ID. | 57 // The extension URL, including the extension scheme and extension ID. |
| 59 GURL extension_url_; | 58 GURL extension_url_; |
| 60 | 59 |
| 61 DISALLOW_COPY_AND_ASSIGN(ExtensionViewGuest); | 60 DISALLOW_COPY_AND_ASSIGN(ExtensionViewGuest); |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 } // namespace extensions | 63 } // namespace extensions |
| 65 | 64 |
| 66 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_ | 65 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_ |
| OLD | NEW |