Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / extensions / browser / app_window / app_web_contents_helper.h
blob8e45eba594809b52c4965d66465b788a7401949d
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_APP_WINDOW_APP_WEB_CONTENTS_HELPER_H_
6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WEB_CONTENTS_HELPER_H_
8 #include "content/public/common/media_stream_request.h"
10 namespace blink {
11 class WebGestureEvent;
14 namespace content {
15 class BrowserContext;
16 struct OpenURLParams;
17 class WebContents;
20 namespace extensions {
22 class AppDelegate;
23 class Extension;
25 // Provides common functionality for apps and launcher pages to respond to
26 // messages from a WebContents.
27 class AppWebContentsHelper {
28 public:
29 AppWebContentsHelper(content::BrowserContext* browser_context,
30 const std::string& extension_id,
31 content::WebContents* web_contents,
32 AppDelegate* app_delegate);
34 // Returns true if the given |event| should not be handled by the renderer.
35 static bool ShouldSuppressGestureEvent(const blink::WebGestureEvent& event);
37 // Opens a new URL inside the passed in WebContents. See WebContentsDelegate.
38 content::WebContents* OpenURLFromTab(
39 const content::OpenURLParams& params) const;
41 // Requests to lock the mouse. See WebContentsDelegate.
42 void RequestToLockMouse() const;
44 // Asks permission to use the camera and/or microphone. See
45 // WebContentsDelegate.
46 void RequestMediaAccessPermission(
47 const content::MediaStreamRequest& request,
48 const content::MediaResponseCallback& callback) const;
50 // Checks permission to use the camera or microphone. See
51 // WebContentsDelegate.
52 bool CheckMediaAccessPermission(const GURL& security_origin,
53 content::MediaStreamType type) const;
55 private:
56 const Extension* GetExtension() const;
58 // The browser context with which this window is associated.
59 // AppWindowWebContentsDelegate does not own this object.
60 content::BrowserContext* browser_context_;
62 const std::string extension_id_;
64 content::WebContents* web_contents_;
66 AppDelegate* app_delegate_;
68 DISALLOW_COPY_AND_ASSIGN(AppWebContentsHelper);
71 } // namespace extensions
73 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WEB_CONTENTS_HELPER_H_