CacheStorage: Remove unused interfaces from CacheStorageListener
[chromium-blink-merge.git] / apps / custom_launcher_page_contents.h
blob919bbe3c2db305031f55bffd95f9544d77427931
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 APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_
6 #define APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/public/browser/web_contents_delegate.h"
10 #include "content/public/browser/web_contents_observer.h"
11 #include "extensions/browser/extension_function_dispatcher.h"
13 class GURL;
15 namespace content {
16 class BrowserContext;
19 namespace extensions {
20 class AppDelegate;
21 class AppWebContentsHelper;
24 namespace apps {
26 // Manages the web contents for extension-hosted launcher pages. The
27 // implementation for this class should create and maintain the WebContents for
28 // the page, and handle any message passing between the web contents and the
29 // extension system.
30 class CustomLauncherPageContents
31 : public content::WebContentsDelegate,
32 public content::WebContentsObserver,
33 public extensions::ExtensionFunctionDispatcher::Delegate {
34 public:
35 CustomLauncherPageContents(scoped_ptr<extensions::AppDelegate> app_delegate,
36 const std::string& extension_id);
37 ~CustomLauncherPageContents() override;
39 // Called to initialize and load the WebContents.
40 void Initialize(content::BrowserContext* context, const GURL& url);
42 content::WebContents* web_contents() const { return web_contents_.get(); }
44 // content::WebContentsDelegate overrides:
45 content::WebContents* OpenURLFromTab(
46 content::WebContents* source,
47 const content::OpenURLParams& params) override;
48 void AddNewContents(content::WebContents* source,
49 content::WebContents* new_contents,
50 WindowOpenDisposition disposition,
51 const gfx::Rect& initial_rect,
52 bool user_gesture,
53 bool* was_blocked) override;
54 bool IsPopupOrPanel(const content::WebContents* source) const override;
55 bool ShouldSuppressDialogs(content::WebContents* source) override;
56 bool PreHandleGestureEvent(content::WebContents* source,
57 const blink::WebGestureEvent& event) override;
58 content::ColorChooser* OpenColorChooser(
59 content::WebContents* web_contents,
60 SkColor color,
61 const std::vector<content::ColorSuggestion>& suggestions) override;
62 void RunFileChooser(content::WebContents* tab,
63 const content::FileChooserParams& params) override;
64 void RequestToLockMouse(content::WebContents* web_contents,
65 bool user_gesture,
66 bool last_unlocked_by_target) override;
67 void RequestMediaAccessPermission(
68 content::WebContents* web_contents,
69 const content::MediaStreamRequest& request,
70 const content::MediaResponseCallback& callback) override;
71 bool CheckMediaAccessPermission(content::WebContents* web_contents,
72 const GURL& security_origin,
73 content::MediaStreamType type) override;
75 private:
76 // content::WebContentsObserver overrides:
77 bool OnMessageReceived(const IPC::Message& message) override;
79 // extensions::ExtensionFunctionDispatcher::Delegate overrides:
80 extensions::WindowController* GetExtensionWindowController() const override;
81 content::WebContents* GetAssociatedWebContents() const override;
83 void OnRequest(const ExtensionHostMsg_Request_Params& params);
85 scoped_ptr<content::WebContents> web_contents_;
86 scoped_ptr<extensions::ExtensionFunctionDispatcher>
87 extension_function_dispatcher_;
88 scoped_ptr<extensions::AppDelegate> app_delegate_;
89 scoped_ptr<extensions::AppWebContentsHelper> helper_;
91 std::string extension_id_;
93 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents);
96 } // namespace apps
98 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_