Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: content/public/common/registry_utils_win.cc

Issue 324593004: Windows: Add an "Open in Adobe Reader" menu item for PDF files in the download shelf. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/public/common/registry_utils_win.h"
6
7 #include "base/files/file_path.h"
8 #include "base/win/registry.h"
9 #include "base/win/windows_version.h"
10
11 namespace content {
12
13 const base::char16 kRegistryAppsKey[] =
14 L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths";
15 const base::char16 kRegistryPath[] = L"Path";
16
17 const base::char16 kRegistryAcrobat[] = L"Acrobat.exe";
18 const base::char16 kRegistryAcrobatReader[] = L"AcroRd32.exe";
19
20 bool GetInstalledPath(const base::char16* app, base::FilePath* out) {
21 base::string16 reg_path(kRegistryAppsKey);
22 reg_path.append(L"\\");
23 reg_path.append(app);
24
25 base::win::RegKey hkcu_key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ);
26 base::string16 path;
27 // As of Win7 AppPaths can also be registered in HKCU: http://goo.gl/UgFOf.
28 if (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
29 hkcu_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) {
30 *out = base::FilePath(path);
31 return true;
32 } else {
33 base::win::RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ);
34 if (hklm_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) {
35 *out = base::FilePath(path);
36 return true;
37 }
38 }
39
40 return false;
41 }
42
43 } // namespace content
OLDNEW
« content/public/common/registry_utils_win.h ('K') | « content/public/common/registry_utils_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698