| 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 "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
| 12 #include "extensions/browser/app_window/app_delegate.h" | 12 #include "extensions/browser/app_window/app_delegate.h" |
| 13 #include "ui/base/window_open_disposition.h" | 13 #include "ui/base/window_open_disposition.h" |
| 14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class BrowserContext; | 17 class BrowserContext; |
| 18 class WebContents; | 18 class WebContents; |
| 19 } | 19 } |
| 20 | 20 |
| 21 class ScopedKeepAlive; |
| 22 |
| 21 class ChromeAppDelegate : public extensions::AppDelegate, | 23 class ChromeAppDelegate : public extensions::AppDelegate, |
| 22 public content::NotificationObserver { | 24 public content::NotificationObserver { |
| 23 public: | 25 public: |
| 24 ChromeAppDelegate(); | 26 // Pass a ScopedKeepAlive to prevent the browser process from shutting down |
| 27 // while this object exists. |
| 28 explicit ChromeAppDelegate(scoped_ptr<ScopedKeepAlive> keep_alive); |
| 25 virtual ~ChromeAppDelegate(); | 29 virtual ~ChromeAppDelegate(); |
| 26 | 30 |
| 27 static void DisableExternalOpenForTesting(); | 31 static void DisableExternalOpenForTesting(); |
| 28 | 32 |
| 29 private: | 33 private: |
| 30 class NewWindowContentsDelegate; | 34 class NewWindowContentsDelegate; |
| 31 | 35 |
| 32 // extensions::AppDelegate: | 36 // extensions::AppDelegate: |
| 33 virtual void InitWebContents(content::WebContents* web_contents) OVERRIDE; | 37 virtual void InitWebContents(content::WebContents* web_contents) OVERRIDE; |
| 34 virtual void ResizeWebContents(content::WebContents* web_contents, | 38 virtual void ResizeWebContents(content::WebContents* web_contents, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 64 bool blocked) OVERRIDE; | 68 bool blocked) OVERRIDE; |
| 65 virtual bool IsWebContentsVisible( | 69 virtual bool IsWebContentsVisible( |
| 66 content::WebContents* web_contents) OVERRIDE; | 70 content::WebContents* web_contents) OVERRIDE; |
| 67 virtual void SetTerminatingCallback(const base::Closure& callback) OVERRIDE; | 71 virtual void SetTerminatingCallback(const base::Closure& callback) OVERRIDE; |
| 68 | 72 |
| 69 // content::NotificationObserver: | 73 // content::NotificationObserver: |
| 70 virtual void Observe(int type, | 74 virtual void Observe(int type, |
| 71 const content::NotificationSource& source, | 75 const content::NotificationSource& source, |
| 72 const content::NotificationDetails& details) OVERRIDE; | 76 const content::NotificationDetails& details) OVERRIDE; |
| 73 | 77 |
| 78 scoped_ptr<ScopedKeepAlive> keep_alive_; |
| 74 scoped_ptr<NewWindowContentsDelegate> new_window_contents_delegate_; | 79 scoped_ptr<NewWindowContentsDelegate> new_window_contents_delegate_; |
| 75 base::Closure terminating_callback_; | 80 base::Closure terminating_callback_; |
| 76 content::NotificationRegistrar registrar_; | 81 content::NotificationRegistrar registrar_; |
| 77 | 82 |
| 78 DISALLOW_COPY_AND_ASSIGN(ChromeAppDelegate); | 83 DISALLOW_COPY_AND_ASSIGN(ChromeAppDelegate); |
| 79 }; | 84 }; |
| 80 | 85 |
| 81 #endif // CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ | 86 #endif // CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ |
| OLD | NEW |