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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
13 #include "extensions/browser/app_window/app_delegate.h" | 13 #include "extensions/browser/app_window/app_delegate.h" |
14 #include "ui/base/window_open_disposition.h" | 14 #include "ui/base/window_open_disposition.h" |
15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
16 | 16 |
| 17 namespace browser_lifetime { |
17 class ScopedKeepAlive; | 18 class ScopedKeepAlive; |
| 19 } |
18 | 20 |
19 class ChromeAppDelegate : public extensions::AppDelegate, | 21 class ChromeAppDelegate : public extensions::AppDelegate, |
20 public content::NotificationObserver { | 22 public content::NotificationObserver { |
21 public: | 23 public: |
22 // Pass a ScopedKeepAlive to prevent the browser process from shutting down | 24 // Pass a ScopedKeepAlive to prevent the browser process from shutting down |
23 // while this object exists. | 25 // while this object exists. |
24 explicit ChromeAppDelegate(scoped_ptr<ScopedKeepAlive> keep_alive); | 26 explicit ChromeAppDelegate( |
| 27 scoped_ptr<browser_lifetime::ScopedKeepAlive> keep_alive); |
25 ~ChromeAppDelegate() override; | 28 ~ChromeAppDelegate() override; |
26 | 29 |
27 static void DisableExternalOpenForTesting(); | 30 static void DisableExternalOpenForTesting(); |
28 | 31 |
29 private: | 32 private: |
30 static void RelinquishKeepAliveAfterTimeout( | 33 static void RelinquishKeepAliveAfterTimeout( |
31 const base::WeakPtr<ChromeAppDelegate>& chrome_app_delegate); | 34 const base::WeakPtr<ChromeAppDelegate>& chrome_app_delegate); |
32 | 35 |
33 class NewWindowContentsDelegate; | 36 class NewWindowContentsDelegate; |
34 | 37 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void OnHide() override; | 72 void OnHide() override; |
70 void OnShow() override; | 73 void OnShow() override; |
71 | 74 |
72 // content::NotificationObserver: | 75 // content::NotificationObserver: |
73 void Observe(int type, | 76 void Observe(int type, |
74 const content::NotificationSource& source, | 77 const content::NotificationSource& source, |
75 const content::NotificationDetails& details) override; | 78 const content::NotificationDetails& details) override; |
76 | 79 |
77 bool has_been_shown_; | 80 bool has_been_shown_; |
78 bool is_hidden_; | 81 bool is_hidden_; |
79 scoped_ptr<ScopedKeepAlive> keep_alive_; | 82 scoped_ptr<browser_lifetime::ScopedKeepAlive> keep_alive_; |
80 scoped_ptr<NewWindowContentsDelegate> new_window_contents_delegate_; | 83 scoped_ptr<NewWindowContentsDelegate> new_window_contents_delegate_; |
81 base::Closure terminating_callback_; | 84 base::Closure terminating_callback_; |
82 content::NotificationRegistrar registrar_; | 85 content::NotificationRegistrar registrar_; |
83 base::WeakPtrFactory<ChromeAppDelegate> weak_factory_; | 86 base::WeakPtrFactory<ChromeAppDelegate> weak_factory_; |
84 | 87 |
85 DISALLOW_COPY_AND_ASSIGN(ChromeAppDelegate); | 88 DISALLOW_COPY_AND_ASSIGN(ChromeAppDelegate); |
86 }; | 89 }; |
87 | 90 |
88 #endif // CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ | 91 #endif // CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ |
OLD | NEW |