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> |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "base/win/scoped_comptr.h" | 25 #include "base/win/scoped_comptr.h" |
26 #include "base/win/windows_version.h" | 26 #include "base/win/windows_version.h" |
27 #include "chrome/browser/web_applications/web_app.h" | 27 #include "chrome/browser/web_applications/web_app.h" |
28 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
29 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
30 #include "chrome/common/chrome_paths_internal.h" | 30 #include "chrome/common/chrome_paths_internal.h" |
31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/installer/setup/setup_util.h" | 32 #include "chrome/installer/setup/setup_util.h" |
33 #include "chrome/installer/util/browser_distribution.h" | 33 #include "chrome/installer/util/browser_distribution.h" |
34 #include "chrome/installer/util/create_reg_key_work_item.h" | 34 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 35 #include "chrome/installer/util/install_util.h" |
35 #include "chrome/installer/util/set_reg_value_work_item.h" | 36 #include "chrome/installer/util/set_reg_value_work_item.h" |
36 #include "chrome/installer/util/shell_util.h" | 37 #include "chrome/installer/util/shell_util.h" |
37 #include "chrome/installer/util/util_constants.h" | 38 #include "chrome/installer/util/util_constants.h" |
38 #include "chrome/installer/util/work_item.h" | 39 #include "chrome/installer/util/work_item.h" |
39 #include "chrome/installer/util/work_item_list.h" | 40 #include "chrome/installer/util/work_item_list.h" |
40 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
41 | 42 |
42 using content::BrowserThread; | 43 using content::BrowserThread; |
43 | 44 |
44 namespace { | 45 namespace { |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 605 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
605 FilePath chrome_exe; | 606 FilePath chrome_exe; |
606 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { | 607 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
607 NOTREACHED(); | 608 NOTREACHED(); |
608 return false; | 609 return false; |
609 } | 610 } |
610 const string16 app_id( | 611 const string16 app_id( |
611 ShellUtil::GetBrowserModelId(dist, chrome_exe.value())); | 612 ShellUtil::GetBrowserModelId(dist, chrome_exe.value())); |
612 return ActivateApplication(app_id); | 613 return ActivateApplication(app_id); |
613 } | 614 } |
| 615 |
| 616 FilePath ShellIntegration::GetStartMenuShortcut(const FilePath& chrome_exe) { |
| 617 static const int kFolderIds[] = { |
| 618 base::DIR_COMMON_START_MENU, |
| 619 base::DIR_START_MENU, |
| 620 }; |
| 621 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 622 string16 shortcut_name(dist->GetAppShortCutName()); |
| 623 FilePath shortcut; |
| 624 |
| 625 // Check both the common and the per-user Start Menu folders for system-level |
| 626 // installs. |
| 627 size_t folder = |
| 628 InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()) ? 1 : 0; |
| 629 for (; folder < arraysize(kFolderIds); ++folder) { |
| 630 if (!PathService::Get(kFolderIds[folder], &shortcut)) { |
| 631 NOTREACHED(); |
| 632 continue; |
| 633 } |
| 634 |
| 635 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk"); |
| 636 if (file_util::PathExists(shortcut)) |
| 637 return shortcut; |
| 638 } |
| 639 |
| 640 return FilePath(); |
| 641 } |
OLD | NEW |