| 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/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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "base/stringprintf.h" | 19 #include "base/stringprintf.h" |
| 20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 21 #include "base/win/registry.h" | 21 #include "base/win/registry.h" |
| 22 #include "base/win/scoped_co_mem.h" | 22 #include "base/win/scoped_co_mem.h" |
| 23 #include "base/win/scoped_comptr.h" | 23 #include "base/win/scoped_comptr.h" |
| 24 #include "base/win/shortcut.h" |
| 24 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
| 25 #include "chrome/browser/web_applications/web_app.h" | 26 #include "chrome/browser/web_applications/web_app.h" |
| 26 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
| 27 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
| 28 #include "chrome/common/chrome_paths_internal.h" | 29 #include "chrome/common/chrome_paths_internal.h" |
| 29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/installer/setup/setup_util.h" | 31 #include "chrome/installer/setup/setup_util.h" |
| 31 #include "chrome/installer/util/browser_distribution.h" | 32 #include "chrome/installer/util/browser_distribution.h" |
| 32 #include "chrome/installer/util/create_reg_key_work_item.h" | 33 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 33 #include "chrome/installer/util/install_util.h" | 34 #include "chrome/installer/util/install_util.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 string16 expected_app_id; | 330 string16 expected_app_id; |
| 330 if (!GetExpectedAppId(chrome_exe, shell_link, &expected_app_id) || | 331 if (!GetExpectedAppId(chrome_exe, shell_link, &expected_app_id) || |
| 331 expected_app_id.empty()) | 332 expected_app_id.empty()) |
| 332 continue; | 333 continue; |
| 333 | 334 |
| 334 // Get existing app id from shortcut if any. | 335 // Get existing app id from shortcut if any. |
| 335 string16 existing_app_id; | 336 string16 existing_app_id; |
| 336 GetShortcutAppId(shell_link, &existing_app_id); | 337 GetShortcutAppId(shell_link, &existing_app_id); |
| 337 | 338 |
| 338 if (expected_app_id != existing_app_id) { | 339 if (expected_app_id != existing_app_id) { |
| 339 file_util::CreateOrUpdateShortcutLink(NULL, shortcut.value().c_str(), | 340 base::win::ShortcutProperties properties_app_id_only; |
| 340 NULL, NULL, NULL, NULL, 0, | 341 properties_app_id_only.set_app_id(expected_app_id); |
| 341 expected_app_id.c_str(), | 342 base::win::CreateOrUpdateShortcutLink( |
| 342 file_util::SHORTCUT_NO_OPTIONS); | 343 shortcut, properties_app_id_only, |
| 344 base::win::SHORTCUT_UPDATE_EXISTING); |
| 343 } | 345 } |
| 344 } | 346 } |
| 345 } | 347 } |
| 346 | 348 |
| 347 void MigrateChromiumShortcutsCallback() { | 349 void MigrateChromiumShortcutsCallback() { |
| 348 // This should run on the file thread. | 350 // This should run on the file thread. |
| 349 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 351 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 350 | 352 |
| 351 // Get full path of chrome. | 353 // Get full path of chrome. |
| 352 FilePath chrome_exe; | 354 FilePath chrome_exe; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 continue; | 586 continue; |
| 585 } | 587 } |
| 586 | 588 |
| 587 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk"); | 589 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk"); |
| 588 if (file_util::PathExists(shortcut)) | 590 if (file_util::PathExists(shortcut)) |
| 589 return shortcut; | 591 return shortcut; |
| 590 } | 592 } |
| 591 | 593 |
| 592 return FilePath(); | 594 return FilePath(); |
| 593 } | 595 } |
| OLD | NEW |