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.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
6 | 6 |
7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "apps/app_load_service.h" | 10 #include "apps/app_load_service.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 #endif | 80 #endif |
81 | 81 |
82 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) | 82 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) |
83 #include "ui/events/devices/x11/touch_factory_x11.h" | 83 #include "ui/events/devices/x11/touch_factory_x11.h" |
84 #endif | 84 #endif |
85 | 85 |
86 #if defined(OS_MACOSX) | 86 #if defined(OS_MACOSX) |
87 #include "chrome/browser/web_applications/web_app_mac.h" | 87 #include "chrome/browser/web_applications/web_app_mac.h" |
88 #endif | 88 #endif |
89 | 89 |
| 90 #if defined(OS_WIN) |
| 91 #include "chrome/browser/metrics/jumplist_metrics_win.h" |
| 92 #endif |
| 93 |
90 #if defined(ENABLE_PRINT_PREVIEW) | 94 #if defined(ENABLE_PRINT_PREVIEW) |
91 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 95 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
92 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 96 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
93 #include "chrome/browser/printing/print_dialog_cloud.h" | 97 #include "chrome/browser/printing/print_dialog_cloud.h" |
94 #endif | 98 #endif |
95 | 99 |
96 using content::BrowserThread; | 100 using content::BrowserThread; |
97 using content::ChildProcessSecurityPolicy; | 101 using content::ChildProcessSecurityPolicy; |
98 | 102 |
99 namespace { | 103 namespace { |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 624 |
621 // Return early here since we don't want to open a browser window. | 625 // Return early here since we don't want to open a browser window. |
622 // The exception is when there are no browser windows, since we don't want | 626 // The exception is when there are no browser windows, since we don't want |
623 // chrome to shut down. | 627 // chrome to shut down. |
624 // TODO(jackhou): Do this properly once keep-alive is handled by the | 628 // TODO(jackhou): Do this properly once keep-alive is handled by the |
625 // background page of apps. Tracked at http://crbug.com/175381 | 629 // background page of apps. Tracked at http://crbug.com/175381 |
626 if (chrome::GetTotalBrowserCountForProfile(last_used_profile) != 0) | 630 if (chrome::GetTotalBrowserCountForProfile(last_used_profile) != 0) |
627 return true; | 631 return true; |
628 } | 632 } |
629 | 633 |
| 634 #if defined(OS_WIN) |
| 635 // Log whether this process was a result of an action in the Windows Jumplist. |
| 636 if (command_line.HasSwitch(switches::kWinJumplistAction)) { |
| 637 jumplist::LogJumplistActionFromSwitchValue( |
| 638 command_line.GetSwitchValueASCII(switches::kWinJumplistAction)); |
| 639 } |
| 640 |
| 641 // If the profile is loaded and the --activate-existing-profile-browser flag |
| 642 // is used, activate one of the profile's browser windows, if one exists. |
| 643 // Continuing to process the command line is not needed, since this will |
| 644 // end up opening a new browser window. |
| 645 if (command_line.HasSwitch(switches::kActivateExistingProfileBrowser)) { |
| 646 Browser* browser = chrome::FindTabbedBrowser( |
| 647 last_used_profile, false, chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 648 if (browser) { |
| 649 browser->window()->Activate(); |
| 650 return true; |
| 651 } |
| 652 } |
| 653 #endif |
| 654 |
630 VLOG(2) << "ProcessCmdLineImpl: PLACE 5"; | 655 VLOG(2) << "ProcessCmdLineImpl: PLACE 5"; |
631 chrome::startup::IsProcessStartup is_process_startup = process_startup ? | 656 chrome::startup::IsProcessStartup is_process_startup = process_startup ? |
632 chrome::startup::IS_PROCESS_STARTUP : | 657 chrome::startup::IS_PROCESS_STARTUP : |
633 chrome::startup::IS_NOT_PROCESS_STARTUP; | 658 chrome::startup::IS_NOT_PROCESS_STARTUP; |
634 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? | 659 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? |
635 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | 660 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
636 // |last_opened_profiles| will be empty in the following circumstances: | 661 // |last_opened_profiles| will be empty in the following circumstances: |
637 // - This is the first launch. |last_used_profile| is the initial profile. | 662 // - This is the first launch. |last_used_profile| is the initial profile. |
638 // - The user exited the browser by closing all windows for all | 663 // - The user exited the browser by closing all windows for all |
639 // profiles. |last_used_profile| is the profile which owned the last open | 664 // profiles. |last_used_profile| is the profile which owned the last open |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 // If we are showing the app list then chrome isn't shown so load the app | 807 // If we are showing the app list then chrome isn't shown so load the app |
783 // list's profile rather than chrome's. | 808 // list's profile rather than chrome's. |
784 if (command_line.HasSwitch(switches::kShowAppList)) { | 809 if (command_line.HasSwitch(switches::kShowAppList)) { |
785 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> | 810 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> |
786 GetProfilePath(user_data_dir); | 811 GetProfilePath(user_data_dir); |
787 } | 812 } |
788 | 813 |
789 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 814 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
790 user_data_dir); | 815 user_data_dir); |
791 } | 816 } |
OLD | NEW |