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

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

Issue 557833007: Remove Increment/DecrementKeepAliveCount from AppsClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 3 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/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 12 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
12 #include "chrome/browser/favicon/favicon_tab_helper.h" 13 #include "chrome/browser/favicon/favicon_tab_helper.h"
13 #include "chrome/browser/file_select_helper.h" 14 #include "chrome/browser/file_select_helper.h"
14 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 15 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
15 #include "chrome/browser/platform_util.h" 16 #include "chrome/browser/platform_util.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/shell_integration.h" 18 #include "chrome/browser/shell_integration.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_dialogs.h" 20 #include "chrome/browser/ui/browser_dialogs.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 params)); 142 params));
142 // Object lifetime notes: The OpenURLFromTabBasedOnBrowserDefault is owned 143 // Object lifetime notes: The OpenURLFromTabBasedOnBrowserDefault is owned
143 // by check_if_default_browser_worker. StartCheckIsDefault() takes lifetime 144 // by check_if_default_browser_worker. StartCheckIsDefault() takes lifetime
144 // ownership of check_if_default_browser_worker and will clean up after 145 // ownership of check_if_default_browser_worker and will clean up after
145 // the asynchronous tasks. 146 // the asynchronous tasks.
146 check_if_default_browser_worker->StartCheckIsDefault(); 147 check_if_default_browser_worker->StartCheckIsDefault();
147 } 148 }
148 return NULL; 149 return NULL;
149 } 150 }
150 151
151 ChromeAppDelegate::ChromeAppDelegate() 152 ChromeAppDelegate::ChromeAppDelegate(scoped_ptr<ScopedKeepAlive> keep_alive)
152 : new_window_contents_delegate_(new NewWindowContentsDelegate()) { 153 : keep_alive_(keep_alive.Pass()),
154 new_window_contents_delegate_(new NewWindowContentsDelegate()) {
153 registrar_.Add(this, 155 registrar_.Add(this,
154 chrome::NOTIFICATION_APP_TERMINATING, 156 chrome::NOTIFICATION_APP_TERMINATING,
155 content::NotificationService::AllSources()); 157 content::NotificationService::AllSources());
156 } 158 }
157 159
158 ChromeAppDelegate::~ChromeAppDelegate() { 160 ChromeAppDelegate::~ChromeAppDelegate() {
161 // Unregister now to prevent getting notified if |keep_alive_| is the last.
162 terminating_callback_.Reset();
159 } 163 }
160 164
161 void ChromeAppDelegate::DisableExternalOpenForTesting() { 165 void ChromeAppDelegate::DisableExternalOpenForTesting() {
162 disable_external_open_for_testing_ = true; 166 disable_external_open_for_testing_ = true;
163 } 167 }
164 168
165 void ChromeAppDelegate::InitWebContents(content::WebContents* web_contents) { 169 void ChromeAppDelegate::InitWebContents(content::WebContents* web_contents) {
166 FaviconTabHelper::CreateForWebContents(web_contents); 170 FaviconTabHelper::CreateForWebContents(web_contents);
167 171
168 #if defined(ENABLE_PRINTING) 172 #if defined(ENABLE_PRINTING)
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 const content::NotificationDetails& details) { 290 const content::NotificationDetails& details) {
287 switch (type) { 291 switch (type) {
288 case chrome::NOTIFICATION_APP_TERMINATING: 292 case chrome::NOTIFICATION_APP_TERMINATING:
289 if (!terminating_callback_.is_null()) 293 if (!terminating_callback_.is_null())
290 terminating_callback_.Run(); 294 terminating_callback_.Run();
291 break; 295 break;
292 default: 296 default:
293 NOTREACHED() << "Received unexpected notification"; 297 NOTREACHED() << "Received unexpected notification";
294 } 298 }
295 } 299 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/apps/chrome_app_delegate.h ('k') | chrome/browser/ui/apps/chrome_app_window_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698