Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / apps / chrome_app_delegate.h
blob1a7ac1f1c5bc15163691981ac6008d50929fed3e
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 CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_
6 #define CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
13 #include "extensions/browser/app_window/app_delegate.h"
14 #include "ui/base/window_open_disposition.h"
15 #include "ui/gfx/geometry/rect.h"
17 class ScopedKeepAlive;
19 class ChromeAppDelegate : public extensions::AppDelegate,
20 public content::NotificationObserver {
21 public:
22 // Pass a ScopedKeepAlive to prevent the browser process from shutting down
23 // while this object exists.
24 explicit ChromeAppDelegate(scoped_ptr<ScopedKeepAlive> keep_alive);
25 ~ChromeAppDelegate() override;
27 static void DisableExternalOpenForTesting();
29 private:
30 static void RelinquishKeepAliveAfterTimeout(
31 const base::WeakPtr<ChromeAppDelegate>& chrome_app_delegate);
33 class NewWindowContentsDelegate;
35 // extensions::AppDelegate:
36 void InitWebContents(content::WebContents* web_contents) override;
37 void RenderViewCreated(content::RenderViewHost* render_view_host) override;
38 void ResizeWebContents(content::WebContents* web_contents,
39 const gfx::Size& size) override;
40 content::WebContents* OpenURLFromTab(
41 content::BrowserContext* context,
42 content::WebContents* source,
43 const content::OpenURLParams& params) override;
44 void AddNewContents(content::BrowserContext* context,
45 content::WebContents* new_contents,
46 WindowOpenDisposition disposition,
47 const gfx::Rect& initial_rect,
48 bool user_gesture,
49 bool* was_blocked) override;
50 content::ColorChooser* ShowColorChooser(content::WebContents* web_contents,
51 SkColor initial_color) override;
52 void RunFileChooser(content::WebContents* tab,
53 const content::FileChooserParams& params) override;
54 void RequestMediaAccessPermission(
55 content::WebContents* web_contents,
56 const content::MediaStreamRequest& request,
57 const content::MediaResponseCallback& callback,
58 const extensions::Extension* extension) override;
59 bool CheckMediaAccessPermission(
60 content::WebContents* web_contents,
61 const GURL& security_origin,
62 content::MediaStreamType type,
63 const extensions::Extension* extension) override;
64 int PreferredIconSize() override;
65 void SetWebContentsBlocked(content::WebContents* web_contents,
66 bool blocked) override;
67 bool IsWebContentsVisible(content::WebContents* web_contents) override;
68 void SetTerminatingCallback(const base::Closure& callback) override;
69 void OnHide() override;
70 void OnShow() override;
72 // content::NotificationObserver:
73 void Observe(int type,
74 const content::NotificationSource& source,
75 const content::NotificationDetails& details) override;
77 bool has_been_shown_;
78 bool is_hidden_;
79 scoped_ptr<ScopedKeepAlive> keep_alive_;
80 scoped_ptr<NewWindowContentsDelegate> new_window_contents_delegate_;
81 base::Closure terminating_callback_;
82 content::NotificationRegistrar registrar_;
83 base::WeakPtrFactory<ChromeAppDelegate> weak_factory_;
85 DISALLOW_COPY_AND_ASSIGN(ChromeAppDelegate);
88 #endif // CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_