| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/browser_init.h" | 5 #include "chrome/browser/browser_init.h" |
| 6 | 6 |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 int* return_code) { | 700 int* return_code) { |
| 701 DCHECK(profile); | 701 DCHECK(profile); |
| 702 | 702 |
| 703 // Continue with the off-the-record profile from here on if --incognito | 703 // Continue with the off-the-record profile from here on if --incognito |
| 704 if (parsed_command_line.HasSwitch(switches::kIncognito)) | 704 if (parsed_command_line.HasSwitch(switches::kIncognito)) |
| 705 profile = profile->GetOffTheRecordProfile(); | 705 profile = profile->GetOffTheRecordProfile(); |
| 706 | 706 |
| 707 // Are we starting an application? | 707 // Are we starting an application? |
| 708 std::wstring app_url = parsed_command_line.GetSwitchValue(switches::kApp); | 708 std::wstring app_url = parsed_command_line.GetSwitchValue(switches::kApp); |
| 709 if (!app_url.empty()) { | 709 if (!app_url.empty()) { |
| 710 GURL url(app_url); | 710 GURL url(URLFixerUpper::FixupURL(app_url, L"")); |
| 711 // If the application is started for a mailto:url, this machine has some | 711 // If the application is started for a mailto:url, this machine has some |
| 712 // old configuration that we should ignore. This hack saves us from some | 712 // old configuration that we should ignore. This hack saves us from some |
| 713 // infinite loops where we keep forwarding mailto: to the system, resulting | 713 // infinite loops where we keep forwarding mailto: to the system, resulting |
| 714 // in the system asking us to open the mailto app. | 714 // in the system asking us to open the mailto app. |
| 715 if (url.SchemeIs("mailto")) | 715 if (url.SchemeIs("mailto")) |
| 716 url = GURL("about:blank"); | 716 url = GURL("about:blank"); |
| 717 | 717 |
| 718 WebAppLauncher::Launch(profile, url); | 718 WebAppLauncher::Launch(profile, url); |
| 719 return true; | 719 return true; |
| 720 } | 720 } |
| 721 | 721 |
| 722 LaunchWithProfile lwp(cur_dir, parsed_command_line.command_line_string()); | 722 LaunchWithProfile lwp(cur_dir, parsed_command_line.command_line_string()); |
| 723 bool launched = lwp.Launch(profile, process_startup); | 723 bool launched = lwp.Launch(profile, process_startup); |
| 724 if (!launched) { | 724 if (!launched) { |
| 725 LOG(ERROR) << "launch error"; | 725 LOG(ERROR) << "launch error"; |
| 726 if (return_code != NULL) { | 726 if (return_code != NULL) { |
| 727 *return_code = ResultCodes::INVALID_CMDLINE_URL; | 727 *return_code = ResultCodes::INVALID_CMDLINE_URL; |
| 728 } | 728 } |
| 729 return false; | 729 return false; |
| 730 } | 730 } |
| 731 | 731 |
| 732 return true; | 732 return true; |
| 733 } | 733 } |
| OLD | NEW |