blob: 055ee22e78d4c0812a04d0892a1e2236ad29f8cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_
#define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_
#include "base/macros.h"
#include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/browser/guest_view/extension_view/extension_view_guest_delegate.h"
#include "extensions/browser/guest_view/guest_view.h"
#include "url/gurl.h"
namespace content {
class BrowserContext;
}
namespace extensions {
class ExtensionViewGuest
: public extensions::GuestView<ExtensionViewGuest>,
public extensions::ExtensionFunctionDispatcher::Delegate {
public:
static const char Type[];
static extensions::GuestViewBase* Create(
content::WebContents* owner_web_contents);
// Request navigating the guest to the provided |src| URL.
void NavigateGuest(const std::string& src, bool force_navigation);
// GuestViewBase implementation.
bool CanRunInDetachedState() const override;
void CreateWebContents(const base::DictionaryValue& create_params,
const WebContentsCreatedCallback& callback) override;
void DidInitialize(const base::DictionaryValue& create_params) override;
void DidAttachToEmbedder() override;
const char* GetAPINamespace() const override;
int GetTaskPrefix() const override;
// content::WebContentsObserver implementation.
void DidCommitProvisionalLoadForFrame(
content::RenderFrameHost* render_frame_host,
const GURL& url,
ui::PageTransition transition_type) override;
void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) override;
bool OnMessageReceived(const IPC::Message& message) override;
private:
ExtensionViewGuest(content::WebContents* owner_web_contents);
~ExtensionViewGuest() override;
void OnRequest(const ExtensionHostMsg_Request_Params& params);
// Applies attributes to the extensionview.
void ApplyAttributes(const base::DictionaryValue& params);
scoped_ptr<extensions::ExtensionFunctionDispatcher>
extension_function_dispatcher_;
scoped_ptr<extensions::ExtensionViewGuestDelegate>
extension_view_guest_delegate_;
GURL view_page_;
GURL extension_url_;
DISALLOW_COPY_AND_ASSIGN(ExtensionViewGuest);
};
} // namespace extensions
#endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_
|