Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1293)

Side by Side Diff: chrome/browser/ui/apps/chrome_app_delegate.cc

Issue 875273003: Hidden windows should not keep Chrome alive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/app_mode/app_mode_utils.h" 9 #include "chrome/browser/app_mode/app_mode_utils.h"
10 #include "chrome/browser/apps/scoped_keep_alive.h" 10 #include "chrome/browser/apps/scoped_keep_alive.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 297
298 bool ChromeAppDelegate::IsWebContentsVisible( 298 bool ChromeAppDelegate::IsWebContentsVisible(
299 content::WebContents* web_contents) { 299 content::WebContents* web_contents) {
300 return platform_util::IsVisible(web_contents->GetNativeView()); 300 return platform_util::IsVisible(web_contents->GetNativeView());
301 } 301 }
302 302
303 void ChromeAppDelegate::SetTerminatingCallback(const base::Closure& callback) { 303 void ChromeAppDelegate::SetTerminatingCallback(const base::Closure& callback) {
304 terminating_callback_ = callback; 304 terminating_callback_ = callback;
305 } 305 }
306 306
307 void ChromeAppDelegate::OnHide() {
308 keep_alive_.reset();
benwells 2015/01/28 02:42:10 If an app window is created hidden does it get OnH
jackhou1 2015/02/03 06:05:13 Yup, AppWindow::Init calls Hide() if the window is
309 }
310 void ChromeAppDelegate::OnShow() {
benwells 2015/01/28 02:42:10 Nit: Blank line above.
jackhou1 2015/02/03 06:05:13 Done.
311 keep_alive_.reset(new ScopedKeepAlive);
312 }
313
307 void ChromeAppDelegate::Observe(int type, 314 void ChromeAppDelegate::Observe(int type,
308 const content::NotificationSource& source, 315 const content::NotificationSource& source,
309 const content::NotificationDetails& details) { 316 const content::NotificationDetails& details) {
310 switch (type) { 317 switch (type) {
311 case chrome::NOTIFICATION_APP_TERMINATING: 318 case chrome::NOTIFICATION_APP_TERMINATING:
312 if (!terminating_callback_.is_null()) 319 if (!terminating_callback_.is_null())
313 terminating_callback_.Run(); 320 terminating_callback_.Run();
314 break; 321 break;
315 default: 322 default:
316 NOTREACHED() << "Received unexpected notification"; 323 NOTREACHED() << "Received unexpected notification";
317 } 324 }
318 } 325 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/apps/chrome_app_delegate.h ('k') | extensions/browser/app_window/app_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698