1 // Copyright 2014 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_OPTIONS_EXTENSION_OPTIONS_GUEST_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_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 "extensions/browser/guest_view/extension_options/extension_options_guest_delegate.h"
18 namespace extensions
{
20 class ExtensionOptionsGuest
21 : public guest_view::GuestView
<ExtensionOptionsGuest
>,
22 public extensions::ExtensionFunctionDispatcher::Delegate
{
24 static const char Type
[];
25 static guest_view::GuestViewBase
* Create(
26 content::WebContents
* owner_web_contents
);
28 // GuestViewBase implementation.
29 bool CanRunInDetachedState() const override
;
30 void CreateWebContents(const base::DictionaryValue
& create_params
,
31 const WebContentsCreatedCallback
& callback
) override
;
32 void DidInitialize(const base::DictionaryValue
& create_params
) override
;
33 void GuestViewDidStopLoading() override
;
34 const char* GetAPINamespace() const override
;
35 int GetTaskPrefix() const override
;
36 bool IsPreferredSizeModeEnabled() const override
;
37 bool IsDragAndDropEnabled() const override
;
38 void OnPreferredSizeChanged(const gfx::Size
& pref_size
) override
;
40 // ExtensionFunctionDispatcher::Delegate implementation.
41 content::WebContents
* GetAssociatedWebContents() const override
;
43 // content::WebContentsDelegate implementation.
44 content::WebContents
* OpenURLFromTab(
45 content::WebContents
* source
,
46 const content::OpenURLParams
& params
) override
;
47 void CloseContents(content::WebContents
* source
) override
;
48 bool HandleContextMenu(const content::ContextMenuParams
& params
) override
;
49 bool ShouldCreateWebContents(
50 content::WebContents
* web_contents
,
52 int main_frame_route_id
,
53 WindowContainerType window_container_type
,
54 const base::string16
& frame_name
,
55 const GURL
& target_url
,
56 const std::string
& partition_id
,
57 content::SessionStorageNamespace
* session_storage_namespace
) override
;
59 // content::WebContentsObserver implementation.
60 void DidNavigateMainFrame(
61 const content::LoadCommittedDetails
& details
,
62 const content::FrameNavigateParams
& params
) override
;
63 bool OnMessageReceived(const IPC::Message
& message
) override
;
66 explicit ExtensionOptionsGuest(content::WebContents
* owner_web_contents
);
67 ~ExtensionOptionsGuest() override
;
68 void OnRequest(const ExtensionHostMsg_Request_Params
& params
);
70 scoped_ptr
<extensions::ExtensionFunctionDispatcher
>
71 extension_function_dispatcher_
;
72 scoped_ptr
<extensions::ExtensionOptionsGuestDelegate
>
73 extension_options_guest_delegate_
;
76 DISALLOW_COPY_AND_ASSIGN(ExtensionOptionsGuest
);
79 } // namespace extensions
81 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUEST_H_