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

Side by Side Diff: chrome/browser/ui/pdf/adobe_reader_info_win.cc

Issue 384973002: Windows: Find the correct path to Adobe Reader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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/ui/pdf/adobe_reader_info_win.h" 5 #include "chrome/browser/ui/pdf/adobe_reader_info_win.h"
6 6
7 #include <shlwapi.h> 7 #include <shlwapi.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // As of Win7 AppPaths can also be registered in HKCU: http://goo.gl/UgFOf. 50 // As of Win7 AppPaths can also be registered in HKCU: http://goo.gl/UgFOf.
51 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && 51 if (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
52 hkcu_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { 52 hkcu_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) {
53 filepath = base::FilePath(path); 53 filepath = base::FilePath(path);
54 } else { 54 } else {
55 base::win::RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); 55 base::win::RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ);
56 if (hklm_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { 56 if (hklm_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) {
57 filepath = base::FilePath(path); 57 filepath = base::FilePath(path);
58 } 58 }
59 } 59 }
60 60 return filepath.Append(app);
61 return filepath;
62 } 61 }
63 62
64 bool IsPdfMimeType(const content::WebPluginMimeType& plugin_mime_type) { 63 bool IsPdfMimeType(const content::WebPluginMimeType& plugin_mime_type) {
65 return plugin_mime_type.mime_type == kPdfMimeType; 64 return plugin_mime_type.mime_type == kPdfMimeType;
66 } 65 }
67 66
68 AdobeReaderPluginInfo GetReaderPlugin( 67 AdobeReaderPluginInfo GetReaderPlugin(
69 Profile* profile, 68 Profile* profile,
70 const std::vector<content::WebPluginInfo>& plugins) { 69 const std::vector<content::WebPluginInfo>& plugins) {
71 AdobeReaderPluginInfo reader_info; 70 AdobeReaderPluginInfo reader_info;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 base::UTF16ToUTF8(file_version_info->product_version()); 174 base::UTF16ToUTF8(file_version_info->product_version());
176 // Convert 1.2.03.45 to 1.2.3.45 so base::Version considers it as valid. 175 // Convert 1.2.03.45 to 1.2.3.45 so base::Version considers it as valid.
177 for (int i = 1; i <= 9; ++i) { 176 for (int i = 1; i <= 9; ++i) {
178 std::string from = base::StringPrintf(".0%d", i); 177 std::string from = base::StringPrintf(".0%d", i);
179 std::string to = base::StringPrintf(".%d", i); 178 std::string to = base::StringPrintf(".%d", i);
180 ReplaceSubstringsAfterOffset(&reader_version, 0, from, to); 179 ReplaceSubstringsAfterOffset(&reader_version, 0, from, to);
181 } 180 }
182 base::Version file_version(reader_version); 181 base::Version file_version(reader_version);
183 return file_version.IsValid() && !file_version.IsOlderThan(kSecureVersion); 182 return file_version.IsValid() && !file_version.IsOlderThan(kSecureVersion);
184 } 183 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698