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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 is_hidden_ = true; | 329 is_hidden_ = true; |
330 if (has_been_shown_) { | 330 if (has_been_shown_) { |
331 keep_alive_.reset(); | 331 keep_alive_.reset(); |
332 return; | 332 return; |
333 } | 333 } |
334 | 334 |
335 // Hold on to the keep alive for some time to give the app a chance to show | 335 // Hold on to the keep alive for some time to give the app a chance to show |
336 // the window. | 336 // the window. |
337 content::BrowserThread::PostDelayedTask( | 337 content::BrowserThread::PostDelayedTask( |
338 content::BrowserThread::UI, FROM_HERE, | 338 content::BrowserThread::UI, FROM_HERE, |
339 base::Bind(&ChromeAppDelegate::RelinquishKeepAliveAfterTimeout, | 339 base::BindOnce(&ChromeAppDelegate::RelinquishKeepAliveAfterTimeout, |
340 weak_factory_.GetWeakPtr()), | 340 weak_factory_.GetWeakPtr()), |
341 base::TimeDelta::FromSeconds(kAppWindowFirstShowTimeoutSeconds)); | 341 base::TimeDelta::FromSeconds(kAppWindowFirstShowTimeoutSeconds)); |
342 } | 342 } |
343 | 343 |
344 void ChromeAppDelegate::OnShow() { | 344 void ChromeAppDelegate::OnShow() { |
345 has_been_shown_ = true; | 345 has_been_shown_ = true; |
346 is_hidden_ = false; | 346 is_hidden_ = false; |
347 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::CHROME_APP_DELEGATE, | 347 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::CHROME_APP_DELEGATE, |
348 KeepAliveRestartOption::DISABLED)); | 348 KeepAliveRestartOption::DISABLED)); |
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 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); | 354 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); |
355 if (!terminating_callback_.is_null()) | 355 if (!terminating_callback_.is_null()) |
356 terminating_callback_.Run(); | 356 terminating_callback_.Run(); |
357 } | 357 } |
OLD | NEW |