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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_
8 #include "base/macros.h"
9 #include "components/guest_view/browser/guest_view.h"
10 #include "extensions/browser/extension_function_dispatcher.h"
17 namespace extensions
{
19 class ExtensionViewGuest
20 : public guest_view::GuestView
<ExtensionViewGuest
> {
22 static const char Type
[];
23 static guest_view::GuestViewBase
* Create(
24 content::WebContents
* owner_web_contents
);
26 // Request navigating the guest to the provided |src| URL.
27 // Returns true if the navigation is successful.
28 bool NavigateGuest(const std::string
& src
, bool force_navigation
);
30 // GuestViewBase implementation.
31 bool CanRunInDetachedState() const override
;
32 void CreateWebContents(const base::DictionaryValue
& create_params
,
33 const WebContentsCreatedCallback
& callback
) override
;
34 void DidInitialize(const base::DictionaryValue
& create_params
) override
;
35 void DidAttachToEmbedder() override
;
36 const char* GetAPINamespace() const override
;
37 int GetTaskPrefix() const override
;
39 // content::WebContentsObserver implementation.
40 void DidCommitProvisionalLoadForFrame(
41 content::RenderFrameHost
* render_frame_host
,
43 ui::PageTransition transition_type
) override
;
44 void DidNavigateMainFrame(
45 const content::LoadCommittedDetails
& details
,
46 const content::FrameNavigateParams
& params
) override
;
49 ExtensionViewGuest(content::WebContents
* owner_web_contents
);
50 ~ExtensionViewGuest() override
;
52 // Applies attributes to the extensionview.
53 void ApplyAttributes(const base::DictionaryValue
& params
);
55 // The full URL that the extensionview is currently navigated to.
58 // The extension URL, including the extension scheme and extension ID.
61 DISALLOW_COPY_AND_ASSIGN(ExtensionViewGuest
);
64 } // namespace extensions
66 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_