Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / apps / app_delegate.h
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_APP_DELEGATE_H_
6 #define APPS_APP_DELEGATE_H_
7
8 #include "content/public/common/media_stream_request.h"
9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/base/window_open_disposition.h"
11
12 namespace content {
13 class BrowserContext;
14 class ColorChooser;
15 struct FileChooserParams;
16 struct OpenURLParams;
17 class WebContents;
18 }
19
20 namespace extensions {
21 class Extension;
22 }
23
24 namespace gfx {
25 class Rect;
26 }
27
28 namespace apps {
29
30 // Interface to give packaged apps access to services in the browser, for things
31 // like handling links and showing UI prompts to the user.
32 class AppDelegate {
33  public:
34   virtual ~AppDelegate() {}
35
36   // General initialization.
37   virtual void InitWebContents(content::WebContents* web_contents) = 0;
38
39   // Link handling.
40   virtual content::WebContents* OpenURLFromTab(
41       content::BrowserContext* context,
42       content::WebContents* source,
43       const content::OpenURLParams& params) = 0;
44   virtual void AddNewContents(content::BrowserContext* context,
45                               content::WebContents* new_contents,
46                               WindowOpenDisposition disposition,
47                               const gfx::Rect& initial_pos,
48                               bool user_gesture,
49                               bool* was_blocked) = 0;
50
51   // Feature support.
52   virtual content::ColorChooser* ShowColorChooser(
53       content::WebContents* web_contents,
54       SkColor initial_color) = 0;
55   virtual void RunFileChooser(content::WebContents* tab,
56                               const content::FileChooserParams& params) = 0;
57   virtual void RequestMediaAccessPermission(
58       content::WebContents* web_contents,
59       const content::MediaStreamRequest& request,
60       const content::MediaResponseCallback& callback,
61       const extensions::Extension* extension) = 0;
62   virtual int PreferredIconSize() = 0;
63
64   // Web contents modal dialog support.
65   virtual void SetWebContentsBlocked(content::WebContents* web_contents,
66                                      bool blocked) = 0;
67   virtual bool IsWebContentsVisible(content::WebContents* web_contents) = 0;
68 };
69
70 }  // namespace apps
71
72 #endif  // APPS_APP_DELEGATE_H_