Unregister from GCM when the only GCM app is removed
[chromium-blink-merge.git] / extensions / browser / guest_view / extension_options / extension_options_guest.h
blobab62238ccbb581e834105af43997bf3c61467975
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 "extensions/browser/extension_function_dispatcher.h"
10 #include "extensions/browser/guest_view/extension_options/extension_options_guest_delegate.h"
11 #include "extensions/browser/guest_view/guest_view.h"
12 #include "url/gurl.h"
14 namespace content {
15 class BrowserContext;
18 namespace extensions {
20 class ExtensionOptionsGuest
21 : public extensions::GuestView<ExtensionOptionsGuest>,
22 public extensions::ExtensionFunctionDispatcher::Delegate {
23 public:
24 static const char Type[];
25 static extensions::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 DidStopLoading() override;
34 const char* GetAPINamespace() const override;
35 int GetTaskPrefix() const override;
36 void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size,
37 const gfx::Size& new_size) override;
38 bool IsAutoSizeSupported() const override;
39 bool IsPreferredSizeModeEnabled() const override;
40 void OnPreferredSizeChanged(const gfx::Size& pref_size) override;
42 // ExtensionFunctionDispatcher::Delegate implementation.
43 content::WebContents* GetAssociatedWebContents() const override;
45 // content::WebContentsDelegate implementation.
46 content::WebContents* OpenURLFromTab(
47 content::WebContents* source,
48 const content::OpenURLParams& params) override;
49 void CloseContents(content::WebContents* source) override;
50 bool HandleContextMenu(const content::ContextMenuParams& params) override;
51 bool ShouldCreateWebContents(
52 content::WebContents* web_contents,
53 int route_id,
54 int main_frame_route_id,
55 WindowContainerType window_container_type,
56 const base::string16& frame_name,
57 const GURL& target_url,
58 const std::string& partition_id,
59 content::SessionStorageNamespace* session_storage_namespace) override;
61 // content::WebContentsObserver implementation.
62 void DidNavigateMainFrame(
63 const content::LoadCommittedDetails& details,
64 const content::FrameNavigateParams& params) override;
65 bool OnMessageReceived(const IPC::Message& message) override;
67 private:
68 explicit ExtensionOptionsGuest(content::WebContents* owner_web_contents);
69 ~ExtensionOptionsGuest() override;
70 void OnRequest(const ExtensionHostMsg_Request_Params& params);
72 scoped_ptr<extensions::ExtensionFunctionDispatcher>
73 extension_function_dispatcher_;
74 scoped_ptr<extensions::ExtensionOptionsGuestDelegate>
75 extension_options_guest_delegate_;
76 GURL options_page_;
78 DISALLOW_COPY_AND_ASSIGN(ExtensionOptionsGuest);
81 } // namespace extensions
83 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUEST_H_