Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / extensions / browser / app_window / app_delegate.h
blob7b247af3a0937a181343771ff00af40c3809ab92
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_DELEGATE_H_
6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_DELEGATE_H_
8 #include "base/callback_forward.h"
9 #include "content/public/common/media_stream_request.h"
10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/base/window_open_disposition.h"
12 #include "ui/gfx/image/image_skia.h"
14 namespace content {
15 class BrowserContext;
16 class ColorChooser;
17 struct FileChooserParams;
18 struct OpenURLParams;
19 class WebContents;
22 namespace gfx {
23 class Rect;
26 namespace extensions {
28 class Extension;
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() {}
36 // General initialization.
37 virtual void InitWebContents(content::WebContents* web_contents) = 0;
39 // Resizes WebContents.
40 virtual void ResizeWebContents(content::WebContents* web_contents,
41 const gfx::Size& size) = 0;
43 // Link handling.
44 virtual content::WebContents* OpenURLFromTab(
45 content::BrowserContext* context,
46 content::WebContents* source,
47 const content::OpenURLParams& params) = 0;
48 virtual void AddNewContents(content::BrowserContext* context,
49 content::WebContents* new_contents,
50 WindowOpenDisposition disposition,
51 const gfx::Rect& initial_pos,
52 bool user_gesture,
53 bool* was_blocked) = 0;
55 // Feature support.
56 virtual content::ColorChooser* ShowColorChooser(
57 content::WebContents* web_contents,
58 SkColor initial_color) = 0;
59 virtual void RunFileChooser(content::WebContents* tab,
60 const content::FileChooserParams& params) = 0;
61 virtual void RequestMediaAccessPermission(
62 content::WebContents* web_contents,
63 const content::MediaStreamRequest& request,
64 const content::MediaResponseCallback& callback,
65 const Extension* extension) = 0;
66 virtual int PreferredIconSize() = 0;
67 virtual gfx::ImageSkia GetAppDefaultIcon() = 0;
69 // Web contents modal dialog support.
70 virtual void SetWebContentsBlocked(content::WebContents* web_contents,
71 bool blocked) = 0;
72 virtual bool IsWebContentsVisible(content::WebContents* web_contents) = 0;
74 // |callback| will be called when the process is about to terminate.
75 virtual void SetTerminatingCallback(const base::Closure& callback) = 0;
78 } // namespace extensions
80 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_DELEGATE_H_