OLD | NEW |
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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 DCHECK(profile); | 328 DCHECK(profile); |
329 profile_ = profile; | 329 profile_ = profile; |
330 | 330 |
331 if (command_line_.HasSwitch(switches::kDnsLogDetails)) | 331 if (command_line_.HasSwitch(switches::kDnsLogDetails)) |
332 chrome_browser_net::EnablePredictorDetailedLog(true); | 332 chrome_browser_net::EnablePredictorDetailedLog(true); |
333 if (command_line_.HasSwitch(switches::kDnsPrefetchDisable) && | 333 if (command_line_.HasSwitch(switches::kDnsPrefetchDisable) && |
334 profile->GetNetworkPredictor()) { | 334 profile->GetNetworkPredictor()) { |
335 profile->GetNetworkPredictor()->EnablePredictor(false); | 335 profile->GetNetworkPredictor()->EnablePredictor(false); |
336 } | 336 } |
337 | 337 |
338 AppListService::InitAll(profile); | 338 if (AppListService::HandleLaunchCommandLine(command_line_, profile)) |
| 339 return true; |
| 340 |
339 if (command_line_.HasSwitch(switches::kAppId)) { | 341 if (command_line_.HasSwitch(switches::kAppId)) { |
340 std::string app_id = command_line_.GetSwitchValueASCII(switches::kAppId); | 342 std::string app_id = command_line_.GetSwitchValueASCII(switches::kAppId); |
341 const Extension* extension = GetPlatformApp(profile, app_id); | 343 const Extension* extension = GetPlatformApp(profile, app_id); |
342 // If |app_id| is a disabled or terminated platform app we handle it | 344 // If |app_id| is a disabled or terminated platform app we handle it |
343 // specially here, otherwise it will be handled below. | 345 // specially here, otherwise it will be handled below. |
344 if (extension) { | 346 if (extension) { |
345 RecordCmdLineAppHistogram(extensions::Manifest::TYPE_PLATFORM_APP); | 347 RecordCmdLineAppHistogram(extensions::Manifest::TYPE_PLATFORM_APP); |
346 AppLaunchParams params(profile, extension, | 348 AppLaunchParams params(profile, extension, |
347 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW); | 349 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW); |
348 params.command_line = command_line_; | 350 params.command_line = command_line_; |
349 params.current_directory = cur_dir_; | 351 params.current_directory = cur_dir_; |
350 // If we are being launched from the command line, default to native | 352 // If we are being launched from the command line, default to native |
351 // desktop. | 353 // desktop. |
352 params.desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; | 354 params.desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; |
353 OpenApplicationWithReenablePrompt(params); | 355 OpenApplicationWithReenablePrompt(params); |
354 return true; | 356 return true; |
355 } | 357 } |
356 } else if (command_line_.HasSwitch(switches::kShowAppList)) { | |
357 // This switch is used for shortcuts on the native desktop. | |
358 AppListService::RecordShowTimings(command_line_); | |
359 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> | |
360 ShowForProfile(profile); | |
361 return true; | |
362 } | 358 } |
363 | 359 |
364 // Open the required browser windows and tabs. First, see if | 360 // Open the required browser windows and tabs. First, see if |
365 // we're being run as an application window. If so, the user | 361 // we're being run as an application window. If so, the user |
366 // opened an app shortcut. Don't restore tabs or open initial | 362 // opened an app shortcut. Don't restore tabs or open initial |
367 // URLs in that case. The user should see the window as an app, | 363 // URLs in that case. The user should see the window as an app, |
368 // not as chrome. | 364 // not as chrome. |
369 // Special case is when app switches are passed but we do want to restore | 365 // Special case is when app switches are passed but we do want to restore |
370 // session. In that case open app window + focus it after session is restored. | 366 // session. In that case open app window + focus it after session is restored. |
371 content::WebContents* app_contents = NULL; | 367 content::WebContents* app_contents = NULL; |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 // behavior is desired because completing or skipping the sync promo | 919 // behavior is desired because completing or skipping the sync promo |
924 // causes a redirect to the NTP. | 920 // causes a redirect to the NTP. |
925 if (!startup_urls->empty() && | 921 if (!startup_urls->empty() && |
926 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) | 922 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) |
927 startup_urls->at(0) = sync_promo_url; | 923 startup_urls->at(0) = sync_promo_url; |
928 else | 924 else |
929 startup_urls->insert(startup_urls->begin(), sync_promo_url); | 925 startup_urls->insert(startup_urls->begin(), sync_promo_url); |
930 } | 926 } |
931 } | 927 } |
932 } | 928 } |
OLD | NEW |