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" |
11 #include "apps/app_restore_service_factory.h" | 11 #include "apps/app_restore_service_factory.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/environment.h" | 16 #include "base/environment.h" |
17 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
20 #include "base/metrics/statistics_recorder.h" | 20 #include "base/metrics/statistics_recorder.h" |
21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
22 #include "base/prefs/pref_service.h" | 22 #include "base/prefs/pref_service.h" |
23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
24 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
26 #include "base/threading/thread_restrictions.h" | 26 #include "base/threading/thread_restrictions.h" |
27 #include "chrome/browser/apps/install_chrome_app.h" | |
28 #include "chrome/browser/auto_launch_trial.h" | 27 #include "chrome/browser/auto_launch_trial.h" |
29 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
30 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
31 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 30 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
32 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 31 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
33 #include "chrome/browser/defaults.h" | 32 #include "chrome/browser/defaults.h" |
34 #include "chrome/browser/extensions/extension_creator.h" | 33 #include "chrome/browser/extensions/extension_creator.h" |
35 #include "chrome/browser/extensions/launch_util.h" | 34 #include "chrome/browser/extensions/launch_util.h" |
36 #include "chrome/browser/extensions/pack_extension_job.h" | 35 #include "chrome/browser/extensions/pack_extension_job.h" |
37 #include "chrome/browser/first_run/first_run.h" | 36 #include "chrome/browser/first_run/first_run.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 // not as chrome. | 363 // not as chrome. |
365 // Special case is when app switches are passed but we do want to restore | 364 // Special case is when app switches are passed but we do want to restore |
366 // session. In that case open app window + focus it after session is restored. | 365 // session. In that case open app window + focus it after session is restored. |
367 content::WebContents* app_contents = NULL; | 366 content::WebContents* app_contents = NULL; |
368 if (OpenApplicationWindow(profile, &app_contents)) { | 367 if (OpenApplicationWindow(profile, &app_contents)) { |
369 RecordLaunchModeHistogram(LM_AS_WEBAPP); | 368 RecordLaunchModeHistogram(LM_AS_WEBAPP); |
370 } else { | 369 } else { |
371 RecordLaunchModeHistogram(urls_to_open.empty() ? | 370 RecordLaunchModeHistogram(urls_to_open.empty() ? |
372 LM_TO_BE_DECIDED : LM_WITH_URLS); | 371 LM_TO_BE_DECIDED : LM_WITH_URLS); |
373 | 372 |
374 ProcessLaunchURLs(process_startup, urls_to_open, desktop_type); | 373 ProcessLaunchURLs(process_startup, urls_to_open, desktop_type); |
tapted
2014/07/25 03:49:12
Is there a downside to making a copy of `urls_to_o
jackhou1
2014/07/28 02:58:15
If there are multiple last_opened_profiles, this w
| |
375 | 374 |
376 if (command_line_.HasSwitch(switches::kInstallChromeApp)) { | |
377 install_chrome_app::InstallChromeApp( | |
378 command_line_.GetSwitchValueASCII(switches::kInstallChromeApp)); | |
379 } | |
380 | |
381 // If this is an app launch, but we didn't open an app window, it may | 375 // If this is an app launch, but we didn't open an app window, it may |
382 // be an app tab. | 376 // be an app tab. |
383 OpenApplicationTab(profile); | 377 OpenApplicationTab(profile); |
384 | 378 |
385 #if defined(OS_MACOSX) | 379 #if defined(OS_MACOSX) |
386 if (process_startup) { | 380 if (process_startup) { |
387 // Check whether the auto-update system needs to be promoted from user | 381 // Check whether the auto-update system needs to be promoted from user |
388 // to system. | 382 // to system. |
389 KeystoneInfoBar::PromotionInfoBar(profile); | 383 KeystoneInfoBar::PromotionInfoBar(profile); |
390 } | 384 } |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
919 // behavior is desired because completing or skipping the sync promo | 913 // behavior is desired because completing or skipping the sync promo |
920 // causes a redirect to the NTP. | 914 // causes a redirect to the NTP. |
921 if (!startup_urls->empty() && | 915 if (!startup_urls->empty() && |
922 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) | 916 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) |
923 startup_urls->at(0) = sync_promo_url; | 917 startup_urls->at(0) = sync_promo_url; |
924 else | 918 else |
925 startup_urls->insert(startup_urls->begin(), sync_promo_url); | 919 startup_urls->insert(startup_urls->begin(), sync_promo_url); |
926 } | 920 } |
927 } | 921 } |
928 } | 922 } |
OLD | NEW |