| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
| 9 #include <propkey.h> | 9 #include <propkey.h> |
| 10 #include <propvarutil.h> | 10 #include <propvarutil.h> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Return empty string if profile_path is empty | 43 // Return empty string if profile_path is empty |
| 44 if (profile_path.empty()) | 44 if (profile_path.empty()) |
| 45 return std::wstring(); | 45 return std::wstring(); |
| 46 | 46 |
| 47 FilePath default_user_data_dir; | 47 FilePath default_user_data_dir; |
| 48 // Return empty string if profile_path is in default user data | 48 // Return empty string if profile_path is in default user data |
| 49 // dir and is the default profile. | 49 // dir and is the default profile. |
| 50 if (chrome::GetDefaultUserDataDirectory(&default_user_data_dir) && | 50 if (chrome::GetDefaultUserDataDirectory(&default_user_data_dir) && |
| 51 profile_path.DirName() == default_user_data_dir && | 51 profile_path.DirName() == default_user_data_dir && |
| 52 profile_path.BaseName().value() == | 52 profile_path.BaseName().value() == |
| 53 ASCIIToUTF16(chrome::kNotSignedInProfile)) { | 53 ASCIIToUTF16(chrome::kInitialProfile)) { |
| 54 return std::wstring(); | 54 return std::wstring(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Get joined basenames of user data dir and profile. | 57 // Get joined basenames of user data dir and profile. |
| 58 std::wstring basenames = profile_path.DirName().BaseName().value() + | 58 std::wstring basenames = profile_path.DirName().BaseName().value() + |
| 59 L"." + profile_path.BaseName().value(); | 59 L"." + profile_path.BaseName().value(); |
| 60 | 60 |
| 61 std::wstring profile_id; | 61 std::wstring profile_id; |
| 62 profile_id.reserve(basenames.size()); | 62 profile_id.reserve(basenames.size()); |
| 63 | 63 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 return false; | 216 return false; |
| 217 | 217 |
| 218 // Get expected app id from shortcut command line. | 218 // Get expected app id from shortcut command line. |
| 219 CommandLine command_line = CommandLine::FromString(StringPrintf( | 219 CommandLine command_line = CommandLine::FromString(StringPrintf( |
| 220 L"\"%ls\" %ls", source.c_str(), arguments.c_str())); | 220 L"\"%ls\" %ls", source.c_str(), arguments.c_str())); |
| 221 | 221 |
| 222 FilePath profile_path; | 222 FilePath profile_path; |
| 223 if (command_line.HasSwitch(switches::kUserDataDir)) { | 223 if (command_line.HasSwitch(switches::kUserDataDir)) { |
| 224 profile_path = | 224 profile_path = |
| 225 command_line.GetSwitchValuePath(switches::kUserDataDir).AppendASCII( | 225 command_line.GetSwitchValuePath(switches::kUserDataDir).AppendASCII( |
| 226 chrome::kNotSignedInProfile); | 226 chrome::kInitialProfile); |
| 227 } | 227 } |
| 228 | 228 |
| 229 std::wstring app_name; | 229 std::wstring app_name; |
| 230 if (command_line.HasSwitch(switches::kApp)) { | 230 if (command_line.HasSwitch(switches::kApp)) { |
| 231 app_name = UTF8ToWide(web_app::GenerateApplicationNameFromURL( | 231 app_name = UTF8ToWide(web_app::GenerateApplicationNameFromURL( |
| 232 GURL(command_line.GetSwitchValueASCII(switches::kApp)))); | 232 GURL(command_line.GetSwitchValueASCII(switches::kApp)))); |
| 233 } else if (command_line.HasSwitch(switches::kAppId)) { | 233 } else if (command_line.HasSwitch(switches::kAppId)) { |
| 234 app_name = UTF8ToWide(web_app::GenerateApplicationNameFromExtensionId( | 234 app_name = UTF8ToWide(web_app::GenerateApplicationNameFromExtensionId( |
| 235 command_line.GetSwitchValueASCII(switches::kAppId))); | 235 command_line.GetSwitchValueASCII(switches::kAppId))); |
| 236 } else { | 236 } else { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 profile_path); | 519 profile_path); |
| 520 } | 520 } |
| 521 | 521 |
| 522 void ShellIntegration::MigrateChromiumShortcuts() { | 522 void ShellIntegration::MigrateChromiumShortcuts() { |
| 523 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 523 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 524 return; | 524 return; |
| 525 | 525 |
| 526 BrowserThread::PostTask( | 526 BrowserThread::PostTask( |
| 527 BrowserThread::FILE, FROM_HERE, new MigrateChromiumShortcutsTask()); | 527 BrowserThread::FILE, FROM_HERE, new MigrateChromiumShortcutsTask()); |
| 528 } | 528 } |
| OLD | NEW |