Durable Storage: Refactor browser test and test the basic "deny" flow.
[chromium-blink-merge.git] / extensions / browser / guest_view / extension_view / extension_view_guest.h
blobcc968a74ea1620b69644d430b106479f40e9349f
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"
11 #include "url/gurl.h"
13 namespace content {
14 class BrowserContext;
17 namespace extensions {
19 class ExtensionViewGuest
20 : public guest_view::GuestView<ExtensionViewGuest> {
21 public:
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,
42 const GURL& url,
43 ui::PageTransition transition_type) override;
44 void DidNavigateMainFrame(
45 const content::LoadCommittedDetails& details,
46 const content::FrameNavigateParams& params) override;
48 private:
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.
56 GURL url_;
58 // The extension URL, including the extension scheme and extension ID.
59 GURL extension_url_;
61 DISALLOW_COPY_AND_ASSIGN(ExtensionViewGuest);
64 } // namespace extensions
66 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_