OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | |
6 #define APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "content/public/browser/web_contents_delegate.h" | |
11 | |
12 class GURL; | |
13 | |
14 namespace content { | |
15 class BrowserContext; | |
16 } | |
17 | |
18 namespace extensions { | |
19 class AppDelegate; | |
20 class AppWebContentsHelper; | |
21 } | |
22 | |
23 namespace apps { | |
24 | |
25 // Manages the web contents for extension-hosted launcher pages. The | |
26 // implementation for this class should create and maintain the WebContents for | |
27 // the page, and handle any message passing between the web contents and the | |
28 // extension system. | |
29 class CustomLauncherPageContents : public content::WebContentsDelegate { | |
30 public: | |
31 CustomLauncherPageContents( | |
32 std::unique_ptr<extensions::AppDelegate> app_delegate, | |
33 const std::string& extension_id); | |
34 ~CustomLauncherPageContents() override; | |
35 | |
36 // Called to initialize and load the WebContents. | |
37 void Initialize(content::BrowserContext* context, const GURL& url); | |
38 | |
39 content::WebContents* web_contents() const { return web_contents_.get(); } | |
40 | |
41 // content::WebContentsDelegate overrides: | |
42 content::WebContents* OpenURLFromTab( | |
43 content::WebContents* source, | |
44 const content::OpenURLParams& params) override; | |
45 void AddNewContents(content::WebContents* source, | |
46 content::WebContents* new_contents, | |
47 WindowOpenDisposition disposition, | |
48 const gfx::Rect& initial_rect, | |
49 bool user_gesture, | |
50 bool* was_blocked) override; | |
51 bool IsPopupOrPanel(const content::WebContents* source) const override; | |
52 bool ShouldSuppressDialogs(content::WebContents* source) override; | |
53 bool PreHandleGestureEvent(content::WebContents* source, | |
54 const blink::WebGestureEvent& event) override; | |
55 content::ColorChooser* OpenColorChooser( | |
56 content::WebContents* web_contents, | |
57 SkColor color, | |
58 const std::vector<content::ColorSuggestion>& suggestions) override; | |
59 void RunFileChooser(content::RenderFrameHost* render_frame_host, | |
60 const content::FileChooserParams& params) override; | |
61 void RequestToLockMouse(content::WebContents* web_contents, | |
62 bool user_gesture, | |
63 bool last_unlocked_by_target) override; | |
64 void RequestMediaAccessPermission( | |
65 content::WebContents* web_contents, | |
66 const content::MediaStreamRequest& request, | |
67 const content::MediaResponseCallback& callback) override; | |
68 bool CheckMediaAccessPermission(content::WebContents* web_contents, | |
69 const GURL& security_origin, | |
70 content::MediaStreamType type) override; | |
71 | |
72 private: | |
73 std::unique_ptr<content::WebContents> web_contents_; | |
74 std::unique_ptr<extensions::AppDelegate> app_delegate_; | |
75 std::unique_ptr<extensions::AppWebContentsHelper> helper_; | |
76 | |
77 std::string extension_id_; | |
78 | |
79 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents); | |
80 }; | |
81 | |
82 } // namespace apps | |
83 | |
84 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | |
OLD | NEW |