| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/installer/util/create_reg_key_work_item.h" | 30 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 31 #include "chrome/installer/util/set_reg_value_work_item.h" | 31 #include "chrome/installer/util/set_reg_value_work_item.h" |
| 32 #include "chrome/installer/util/shell_util.h" | 32 #include "chrome/installer/util/shell_util.h" |
| 33 #include "chrome/installer/util/util_constants.h" | 33 #include "chrome/installer/util/util_constants.h" |
| 34 #include "chrome/installer/util/work_item.h" | 34 #include "chrome/installer/util/work_item.h" |
| 35 #include "chrome/installer/util/work_item_list.h" | 35 #include "chrome/installer/util/work_item_list.h" |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 // Helper function for ShellIntegration::GetAppId to generates profile id | 39 // Helper function for ShellIntegration::GetAppId to generates profile id |
| 40 // from profile path. "profile_id" is composed of sanitized basenames of | 40 // from profile path. "profile_id" is composed of sanitized basenames of |
| 41 // user data dir and profile dir joined by a ".". | 41 // user data dir and profile dir joined by a ".". |
| 42 std::wstring GetProfileIdFromPath(const FilePath& profile_path) { | 42 std::wstring GetProfileIdFromPath(const FilePath& profile_path) { |
| 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) && |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (command_line.HasSwitch(switches::kUserDataDir)) { | 221 if (command_line.HasSwitch(switches::kUserDataDir)) { |
| 222 profile_path = | 222 profile_path = |
| 223 command_line.GetSwitchValuePath(switches::kUserDataDir).Append( | 223 command_line.GetSwitchValuePath(switches::kUserDataDir).Append( |
| 224 chrome::kNotSignedInProfile); | 224 chrome::kNotSignedInProfile); |
| 225 } | 225 } |
| 226 | 226 |
| 227 std::wstring app_name; | 227 std::wstring app_name; |
| 228 if (command_line.HasSwitch(switches::kApp)) { | 228 if (command_line.HasSwitch(switches::kApp)) { |
| 229 app_name = UTF8ToWide(web_app::GenerateApplicationNameFromURL( | 229 app_name = UTF8ToWide(web_app::GenerateApplicationNameFromURL( |
| 230 GURL(command_line.GetSwitchValueASCII(switches::kApp)))); | 230 GURL(command_line.GetSwitchValueASCII(switches::kApp)))); |
| 231 } else if (command_line.HasSwitch(switches::kAppId)) { |
| 232 app_name = UTF8ToWide(web_app::GenerateApplicationNameFromExtensionId( |
| 233 command_line.GetSwitchValueASCII(switches::kAppId))); |
| 231 } else { | 234 } else { |
| 232 app_name = BrowserDistribution::GetDistribution()->GetBrowserAppId(); | 235 app_name = BrowserDistribution::GetDistribution()->GetBrowserAppId(); |
| 233 } | 236 } |
| 234 | 237 |
| 235 expected_app_id->assign(ShellIntegration::GetAppId(app_name, profile_path)); | 238 expected_app_id->assign(ShellIntegration::GetAppId(app_name, profile_path)); |
| 236 return true; | 239 return true; |
| 237 } | 240 } |
| 238 | 241 |
| 239 bool MigrateChromiumShortcutsTask::GetShortcutAppId( | 242 bool MigrateChromiumShortcutsTask::GetShortcutAppId( |
| 240 IShellLink* shell_link, | 243 IShellLink* shell_link, |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 profile_path); | 413 profile_path); |
| 411 } | 414 } |
| 412 | 415 |
| 413 void ShellIntegration::MigrateChromiumShortcuts() { | 416 void ShellIntegration::MigrateChromiumShortcuts() { |
| 414 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 417 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 415 return; | 418 return; |
| 416 | 419 |
| 417 BrowserThread::PostTask( | 420 BrowserThread::PostTask( |
| 418 BrowserThread::FILE, FROM_HERE, new MigrateChromiumShortcutsTask()); | 421 BrowserThread::FILE, FROM_HERE, new MigrateChromiumShortcutsTask()); |
| 419 } | 422 } |
| OLD | NEW |