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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 #endif | 81 #endif |
82 | 82 |
83 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) | 83 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) |
84 #include "ui/events/x/touch_factory_x11.h" | 84 #include "ui/events/x/touch_factory_x11.h" |
85 #endif | 85 #endif |
86 | 86 |
87 #if defined(OS_MACOSX) | 87 #if defined(OS_MACOSX) |
88 #include "chrome/browser/web_applications/web_app_mac.h" | 88 #include "chrome/browser/web_applications/web_app_mac.h" |
89 #endif | 89 #endif |
90 | 90 |
| 91 #if defined(OS_WIN) |
| 92 #include "chrome/browser/metrics/jumplist_metrics_win.h" |
| 93 #endif |
| 94 |
91 #if defined(ENABLE_FULL_PRINTING) | 95 #if defined(ENABLE_FULL_PRINTING) |
92 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 96 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
93 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 97 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
94 #include "chrome/browser/printing/print_dialog_cloud.h" | 98 #include "chrome/browser/printing/print_dialog_cloud.h" |
95 #endif | 99 #endif |
96 | 100 |
97 using content::BrowserThread; | 101 using content::BrowserThread; |
98 using content::ChildProcessSecurityPolicy; | 102 using content::ChildProcessSecurityPolicy; |
99 | 103 |
100 namespace { | 104 namespace { |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 | 620 |
617 // Return early here since we don't want to open a browser window. | 621 // Return early here since we don't want to open a browser window. |
618 // The exception is when there are no browser windows, since we don't want | 622 // The exception is when there are no browser windows, since we don't want |
619 // chrome to shut down. | 623 // chrome to shut down. |
620 // TODO(jackhou): Do this properly once keep-alive is handled by the | 624 // TODO(jackhou): Do this properly once keep-alive is handled by the |
621 // background page of apps. Tracked at http://crbug.com/175381 | 625 // background page of apps. Tracked at http://crbug.com/175381 |
622 if (chrome::GetTotalBrowserCountForProfile(last_used_profile) != 0) | 626 if (chrome::GetTotalBrowserCountForProfile(last_used_profile) != 0) |
623 return true; | 627 return true; |
624 } | 628 } |
625 | 629 |
| 630 #if defined(OS_WIN) |
| 631 // Log whether this process was a result of an action in the Windows Jumplist. |
| 632 if (command_line.HasSwitch(switches::kWinJumplistAction)) { |
| 633 jumplist::LogJumplistActionFromSwitchValue( |
| 634 command_line.GetSwitchValueASCII(switches::kWinJumplistAction)); |
| 635 } |
| 636 #endif |
| 637 |
| 638 // If the profile is loaded and the --activate-existing-profile-browser flag |
| 639 // is used, activate one of the profile's browser windows, if one exists. |
| 640 // Continuing to process the command line is not needed, since this will |
| 641 // end up opening a new browser window. |
| 642 if (command_line.HasSwitch(switches::kActivateExistingProfileBrowser)) { |
| 643 Browser* browser = chrome::FindTabbedBrowser( |
| 644 last_used_profile, false, chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 645 if (browser) { |
| 646 browser->window()->Activate(); |
| 647 return true; |
| 648 } |
| 649 } |
| 650 |
626 chrome::startup::IsProcessStartup is_process_startup = process_startup ? | 651 chrome::startup::IsProcessStartup is_process_startup = process_startup ? |
627 chrome::startup::IS_PROCESS_STARTUP : | 652 chrome::startup::IS_PROCESS_STARTUP : |
628 chrome::startup::IS_NOT_PROCESS_STARTUP; | 653 chrome::startup::IS_NOT_PROCESS_STARTUP; |
629 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? | 654 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? |
630 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | 655 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
631 // |last_opened_profiles| will be empty in the following circumstances: | 656 // |last_opened_profiles| will be empty in the following circumstances: |
632 // - This is the first launch. |last_used_profile| is the initial profile. | 657 // - This is the first launch. |last_used_profile| is the initial profile. |
633 // - The user exited the browser by closing all windows for all | 658 // - The user exited the browser by closing all windows for all |
634 // profiles. |last_used_profile| is the profile which owned the last open | 659 // profiles. |last_used_profile| is the profile which owned the last open |
635 // window. | 660 // window. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 // If we are showing the app list then chrome isn't shown so load the app | 795 // If we are showing the app list then chrome isn't shown so load the app |
771 // list's profile rather than chrome's. | 796 // list's profile rather than chrome's. |
772 if (command_line.HasSwitch(switches::kShowAppList)) { | 797 if (command_line.HasSwitch(switches::kShowAppList)) { |
773 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> | 798 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> |
774 GetProfilePath(user_data_dir); | 799 GetProfilePath(user_data_dir); |
775 } | 800 } |
776 | 801 |
777 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 802 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
778 user_data_dir); | 803 user_data_dir); |
779 } | 804 } |
OLD | NEW |