OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 #include "extensions/browser/app_window/app_delegate.h" | 14 #include "extensions/browser/app_window/app_delegate.h" |
15 #include "ui/base/window_open_disposition.h" | 15 #include "ui/base/window_open_disposition.h" |
16 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
17 | 17 |
18 class ScopedKeepAlive; | 18 class ScopedKeepAlive; |
19 | 19 |
20 class ChromeAppDelegate : public extensions::AppDelegate, | 20 class ChromeAppDelegate : public extensions::AppDelegate, |
21 public content::NotificationObserver { | 21 public content::NotificationObserver { |
22 public: | 22 public: |
23 // Pass a ScopedKeepAlive to prevent the browser process from shutting down | 23 // Params: |
24 // while this object exists. | 24 // keep_alive: Whether this object should keep the browser alive. |
25 explicit ChromeAppDelegate(scoped_ptr<ScopedKeepAlive> keep_alive); | 25 explicit ChromeAppDelegate(bool keep_alive); |
26 ~ChromeAppDelegate() override; | 26 ~ChromeAppDelegate() override; |
27 | 27 |
28 static void DisableExternalOpenForTesting(); | 28 static void DisableExternalOpenForTesting(); |
29 | 29 |
30 private: | 30 private: |
31 static void RelinquishKeepAliveAfterTimeout( | 31 static void RelinquishKeepAliveAfterTimeout( |
32 const base::WeakPtr<ChromeAppDelegate>& chrome_app_delegate); | 32 const base::WeakPtr<ChromeAppDelegate>& chrome_app_delegate); |
33 | 33 |
34 class NewWindowContentsDelegate; | 34 class NewWindowContentsDelegate; |
35 | 35 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 scoped_ptr<ScopedKeepAlive> keep_alive_; | 80 scoped_ptr<ScopedKeepAlive> keep_alive_; |
81 scoped_ptr<NewWindowContentsDelegate> new_window_contents_delegate_; | 81 scoped_ptr<NewWindowContentsDelegate> new_window_contents_delegate_; |
82 base::Closure terminating_callback_; | 82 base::Closure terminating_callback_; |
83 content::NotificationRegistrar registrar_; | 83 content::NotificationRegistrar registrar_; |
84 base::WeakPtrFactory<ChromeAppDelegate> weak_factory_; | 84 base::WeakPtrFactory<ChromeAppDelegate> weak_factory_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(ChromeAppDelegate); | 86 DISALLOW_COPY_AND_ASSIGN(ChromeAppDelegate); |
87 }; | 87 }; |
88 | 88 |
89 #endif // CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ | 89 #endif // CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ |
OLD | NEW |