Infobar MD refresh: close button.
[chromium-blink-merge.git] / apps / custom_launcher_page_contents.h
blobcd4164cf08b39bcc5614db04a6e35cd039cf002d
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"
11 class GURL;
13 namespace content {
14 class BrowserContext;
17 namespace extensions {
18 class AppDelegate;
19 class AppWebContentsHelper;
22 namespace apps {
24 // Manages the web contents for extension-hosted launcher pages. The
25 // implementation for this class should create and maintain the WebContents for
26 // the page, and handle any message passing between the web contents and the
27 // extension system.
28 class CustomLauncherPageContents : public content::WebContentsDelegate {
29 public:
30 CustomLauncherPageContents(scoped_ptr<extensions::AppDelegate> app_delegate,
31 const std::string& extension_id);
32 ~CustomLauncherPageContents() override;
34 // Called to initialize and load the WebContents.
35 void Initialize(content::BrowserContext* context, const GURL& url);
37 content::WebContents* web_contents() const { return web_contents_.get(); }
39 // content::WebContentsDelegate overrides:
40 content::WebContents* OpenURLFromTab(
41 content::WebContents* source,
42 const content::OpenURLParams& params) override;
43 void AddNewContents(content::WebContents* source,
44 content::WebContents* new_contents,
45 WindowOpenDisposition disposition,
46 const gfx::Rect& initial_rect,
47 bool user_gesture,
48 bool* was_blocked) override;
49 bool IsPopupOrPanel(const content::WebContents* source) const override;
50 bool ShouldSuppressDialogs(content::WebContents* source) override;
51 bool PreHandleGestureEvent(content::WebContents* source,
52 const blink::WebGestureEvent& event) override;
53 content::ColorChooser* OpenColorChooser(
54 content::WebContents* web_contents,
55 SkColor color,
56 const std::vector<content::ColorSuggestion>& suggestions) override;
57 void RunFileChooser(content::WebContents* tab,
58 const content::FileChooserParams& params) override;
59 void RequestToLockMouse(content::WebContents* web_contents,
60 bool user_gesture,
61 bool last_unlocked_by_target) override;
62 void RequestMediaAccessPermission(
63 content::WebContents* web_contents,
64 const content::MediaStreamRequest& request,
65 const content::MediaResponseCallback& callback) override;
66 bool CheckMediaAccessPermission(content::WebContents* web_contents,
67 const GURL& security_origin,
68 content::MediaStreamType type) override;
70 private:
71 scoped_ptr<content::WebContents> web_contents_;
72 scoped_ptr<extensions::AppDelegate> app_delegate_;
73 scoped_ptr<extensions::AppWebContentsHelper> helper_;
75 std::string extension_id_;
77 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents);
80 } // namespace apps
82 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_