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 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | 5 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
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/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "chrome/browser/app_mode/app_mode_utils.h" | 12 #include "chrome/browser/app_mode/app_mode_utils.h" |
13 #include "chrome/browser/apps/scoped_keep_alive.h" | |
14 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 14 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
16 #include "chrome/browser/favicon/favicon_utils.h" | 15 #include "chrome/browser/favicon/favicon_utils.h" |
17 #include "chrome/browser/file_select_helper.h" | 16 #include "chrome/browser/file_select_helper.h" |
| 17 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
18 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 18 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
19 #include "chrome/browser/platform_util.h" | 19 #include "chrome/browser/platform_util.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/shell_integration.h" | 21 #include "chrome/browser/shell_integration.h" |
22 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
23 #include "chrome/browser/ui/browser_dialogs.h" | 23 #include "chrome/browser/ui/browser_dialogs.h" |
24 #include "chrome/browser/ui/browser_navigator_params.h" | 24 #include "chrome/browser/ui/browser_navigator_params.h" |
25 #include "chrome/browser/ui/browser_tabstrip.h" | 25 #include "chrome/browser/ui/browser_tabstrip.h" |
26 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 content::BrowserThread::PostDelayedTask( | 338 content::BrowserThread::PostDelayedTask( |
339 content::BrowserThread::UI, FROM_HERE, | 339 content::BrowserThread::UI, FROM_HERE, |
340 base::Bind(&ChromeAppDelegate::RelinquishKeepAliveAfterTimeout, | 340 base::Bind(&ChromeAppDelegate::RelinquishKeepAliveAfterTimeout, |
341 weak_factory_.GetWeakPtr()), | 341 weak_factory_.GetWeakPtr()), |
342 base::TimeDelta::FromSeconds(kAppWindowFirstShowTimeoutSeconds)); | 342 base::TimeDelta::FromSeconds(kAppWindowFirstShowTimeoutSeconds)); |
343 } | 343 } |
344 | 344 |
345 void ChromeAppDelegate::OnShow() { | 345 void ChromeAppDelegate::OnShow() { |
346 has_been_shown_ = true; | 346 has_been_shown_ = true; |
347 is_hidden_ = false; | 347 is_hidden_ = false; |
348 keep_alive_.reset(new ScopedKeepAlive); | 348 keep_alive_.reset(new ScopedKeepAlive("ChromeAppDelegate")); |
349 } | 349 } |
350 | 350 |
351 void ChromeAppDelegate::Observe(int type, | 351 void ChromeAppDelegate::Observe(int type, |
352 const content::NotificationSource& source, | 352 const content::NotificationSource& source, |
353 const content::NotificationDetails& details) { | 353 const content::NotificationDetails& details) { |
354 switch (type) { | 354 switch (type) { |
355 case chrome::NOTIFICATION_APP_TERMINATING: | 355 case chrome::NOTIFICATION_APP_TERMINATING: |
356 if (!terminating_callback_.is_null()) | 356 if (!terminating_callback_.is_null()) |
357 terminating_callback_.Run(); | 357 terminating_callback_.Run(); |
358 break; | 358 break; |
359 default: | 359 default: |
360 NOTREACHED() << "Received unexpected notification"; | 360 NOTREACHED() << "Received unexpected notification"; |
361 } | 361 } |
362 } | 362 } |
OLD | NEW |