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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 169303002: Fix launching crashed apps from the command line while Chrome is running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/extensions/application_launch.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/startup/startup_browser_creator_impl.h" 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/app_restore_service.h" 10 #include "apps/app_restore_service.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 DCHECK_EQ(type, content::NOTIFICATION_WEB_CONTENTS_DESTROYED); 298 DCHECK_EQ(type, content::NOTIFICATION_WEB_CONTENTS_DESTROYED);
299 contents_ = NULL; 299 contents_ = NULL;
300 } 300 }
301 301
302 content::WebContents* contents_; 302 content::WebContents* contents_;
303 content::NotificationRegistrar registrar_; 303 content::NotificationRegistrar registrar_;
304 304
305 DISALLOW_COPY_AND_ASSIGN(WebContentsCloseObserver); 305 DISALLOW_COPY_AND_ASSIGN(WebContentsCloseObserver);
306 }; 306 };
307 307
308 const Extension* GetDisabledPlatformApp(Profile* profile, 308 const Extension* GetDisabledOrTerminatedPlatformApp(Profile* profile,
309 const std::string& extension_id) { 309 const std::string& extension_id) {
310 ExtensionService* service = 310 ExtensionService* service =
311 extensions::ExtensionSystem::Get(profile)->extension_service(); 311 extensions::ExtensionSystem::Get(profile)->extension_service();
312 const Extension* extension = service->GetExtensionById(extension_id, true); 312 const Extension* extension = service->GetExtensionById(extension_id, true);
313 if (!extension)
314 extension = service->GetTerminatedExtension(extension_id);
313 return extension && extension->is_platform_app() ? extension : NULL; 315 return extension && extension->is_platform_app() ? extension : NULL;
314 } 316 }
315 317
316 } // namespace 318 } // namespace
317 319
318 namespace internals { 320 namespace internals {
319 321
320 GURL GetWelcomePageURL() { 322 GURL GetWelcomePageURL() {
321 std::string welcome_url = l10n_util::GetStringUTF8(IDS_WELCOME_PAGE_URL); 323 std::string welcome_url = l10n_util::GetStringUTF8(IDS_WELCOME_PAGE_URL);
322 return GURL(welcome_url); 324 return GURL(welcome_url);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 if (command_line_.HasSwitch(switches::kDnsLogDetails)) 362 if (command_line_.HasSwitch(switches::kDnsLogDetails))
361 chrome_browser_net::EnablePredictorDetailedLog(true); 363 chrome_browser_net::EnablePredictorDetailedLog(true);
362 if (command_line_.HasSwitch(switches::kDnsPrefetchDisable) && 364 if (command_line_.HasSwitch(switches::kDnsPrefetchDisable) &&
363 profile->GetNetworkPredictor()) { 365 profile->GetNetworkPredictor()) {
364 profile->GetNetworkPredictor()->EnablePredictor(false); 366 profile->GetNetworkPredictor()->EnablePredictor(false);
365 } 367 }
366 368
367 AppListService::InitAll(profile); 369 AppListService::InitAll(profile);
368 if (command_line_.HasSwitch(switches::kAppId)) { 370 if (command_line_.HasSwitch(switches::kAppId)) {
369 std::string app_id = command_line_.GetSwitchValueASCII(switches::kAppId); 371 std::string app_id = command_line_.GetSwitchValueASCII(switches::kAppId);
370 const Extension* extension = GetDisabledPlatformApp(profile, app_id); 372 const Extension* extension =
371 // If |app_id| is a disabled platform app we handle it specially here, 373 GetDisabledOrTerminatedPlatformApp(profile, app_id);
372 // otherwise it will be handled below. 374 // If |app_id| is a disabled or terminated platform app we handle it
375 // specially here, otherwise it will be handled below.
373 if (extension) { 376 if (extension) {
374 RecordCmdLineAppHistogram(extensions::Manifest::TYPE_PLATFORM_APP); 377 RecordCmdLineAppHistogram(extensions::Manifest::TYPE_PLATFORM_APP);
375 AppLaunchParams params(profile, extension, 378 AppLaunchParams params(profile, extension,
376 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW); 379 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW);
377 params.command_line = command_line_; 380 params.command_line = command_line_;
378 params.current_directory = cur_dir_; 381 params.current_directory = cur_dir_;
379 // If we are being launched from the command line, default to native 382 // If we are being launched from the command line, default to native
380 // desktop. 383 // desktop.
381 params.desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; 384 params.desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
382 OpenApplicationWithReenablePrompt(params); 385 OpenApplicationWithReenablePrompt(params);
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 } 992 }
990 993
991 #if !defined(OS_WIN) 994 #if !defined(OS_WIN)
992 // static 995 // static
993 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( 996 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser(
994 Profile* profile, 997 Profile* profile,
995 const std::vector<GURL>& startup_urls) { 998 const std::vector<GURL>& startup_urls) {
996 return false; 999 return false;
997 } 1000 }
998 #endif 1001 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/application_launch.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698