OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/shell_integration.h" | 5 #include "chrome/browser/shell_integration.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/browser/chrome_thread.h" | 13 #include "chrome/browser/chrome_thread.h" |
14 | 14 |
15 std::string ShellIntegration::GetCommandLineArgumentsCommon(const GURL& url, | 15 std::string ShellIntegration::GetCommandLineArgumentsCommon(const GURL& url, |
16 const string16& extension_app_id) { | 16 const string16& extension_app_id) { |
17 const CommandLine cmd = *CommandLine::ForCurrentProcess(); | 17 const CommandLine cmd = *CommandLine::ForCurrentProcess(); |
18 std::wstring arguments_w; | 18 std::wstring arguments_w; |
19 | 19 |
20 // Use the same UserDataDir for new launches that we currently have set. | 20 // Use the same UserDataDir for new launches that we currently have set. |
21 std::wstring user_data_dir = cmd.GetSwitchValue(switches::kUserDataDir); | 21 FilePath user_data_dir = cmd.GetSwitchValuePath(switches::kUserDataDir); |
22 if (!user_data_dir.empty()) { | 22 if (!user_data_dir.value().empty()) { |
23 // Make sure user_data_dir is an absolute path. | 23 // Make sure user_data_dir is an absolute path. |
24 if (file_util::AbsolutePath(&user_data_dir) && | 24 if (file_util::AbsolutePath(&user_data_dir) && |
25 file_util::PathExists(FilePath::FromWStringHack(user_data_dir))) { | 25 file_util::PathExists(user_data_dir)) { |
26 arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kUserDataDir) + | 26 arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kUserDataDir) + |
tfarina
2010/07/08 17:33:11
There is a TODO in some other place about using th
Evan Martin
2010/07/08 17:48:47
Done.
| |
27 L"=\"" + user_data_dir + L"\" "; | 27 L"=\"" + user_data_dir.ToWStringHack() + L"\" "; |
28 } | 28 } |
29 } | 29 } |
30 | 30 |
31 #if defined (OS_CHROMEOS) | 31 #if defined (OS_CHROMEOS) |
32 std::wstring profile = cmd.GetSwitchValue(switches::kProfile); | 32 std::wstring profile = cmd.GetSwitchValue(switches::kProfile); |
33 if (!profile.empty()) { | 33 if (!profile.empty()) { |
34 arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kProfile) + | 34 arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kProfile) + |
35 L"=\"" + profile + L"\" "; | 35 L"=\"" + profile + L"\" "; |
36 } | 36 } |
37 #endif | 37 #endif |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 observer_->SetDefaultBrowserUIState(STATE_IS_DEFAULT); | 139 observer_->SetDefaultBrowserUIState(STATE_IS_DEFAULT); |
140 break; | 140 break; |
141 case UNKNOWN_DEFAULT_BROWSER: | 141 case UNKNOWN_DEFAULT_BROWSER: |
142 observer_->SetDefaultBrowserUIState(STATE_UNKNOWN); | 142 observer_->SetDefaultBrowserUIState(STATE_UNKNOWN); |
143 break; | 143 break; |
144 default: | 144 default: |
145 break; | 145 break; |
146 } | 146 } |
147 } | 147 } |
148 } | 148 } |
OLD | NEW |