OLD | NEW |
---|---|
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 IsPdfMimeType) == plugin.mime_types.end()) | 81 IsPdfMimeType) == plugin.mime_types.end()) |
82 continue; | 82 continue; |
83 scoped_ptr<PluginMetadata> plugin_metadata( | 83 scoped_ptr<PluginMetadata> plugin_metadata( |
84 plugin_finder->GetPluginMetadata(plugins[i])); | 84 plugin_finder->GetPluginMetadata(plugins[i])); |
85 if (plugin_metadata->identifier() != kAdobeReaderIdentifier) | 85 if (plugin_metadata->identifier() != kAdobeReaderIdentifier) |
86 continue; | 86 continue; |
87 | 87 |
88 reader_info.is_installed = true; | 88 reader_info.is_installed = true; |
89 | 89 |
90 if (profile) { | 90 if (profile) { |
91 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile); | 91 scoped_refptr<PluginPrefs> plugin_prefs = |
dcheng
2014/11/21 17:25:18
Note: the plugin rewrote the variable type here. I
Lei Zhang
2014/11/21 17:44:28
This is fine, thanks for catching it.
| |
92 PluginPrefs::GetForProfile(profile); | |
92 PluginPrefs::PolicyStatus plugin_status = | 93 PluginPrefs::PolicyStatus plugin_status = |
93 plugin_prefs->PolicyStatusForPlugin(plugin_metadata->name()); | 94 plugin_prefs->PolicyStatusForPlugin(plugin_metadata->name()); |
94 reader_info.is_enabled = plugin_status != PluginPrefs::POLICY_DISABLED; | 95 reader_info.is_enabled = plugin_status != PluginPrefs::POLICY_DISABLED; |
95 } | 96 } |
96 | 97 |
97 // Adobe Reader will likely always come up as "requires_authorization". | 98 // Adobe Reader will likely always come up as "requires_authorization". |
98 // See http://crbug.com/311655. | 99 // See http://crbug.com/311655. |
99 PluginMetadata::SecurityStatus security_stat = | 100 PluginMetadata::SecurityStatus security_stat = |
100 plugin_metadata->GetSecurityStatus(plugins[i]); | 101 plugin_metadata->GetSecurityStatus(plugins[i]); |
101 reader_info.is_secure = | 102 reader_info.is_secure = |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 base::UTF16ToUTF8(file_version_info->product_version()); | 178 base::UTF16ToUTF8(file_version_info->product_version()); |
178 // Convert 1.2.03.45 to 1.2.3.45 so base::Version considers it as valid. | 179 // Convert 1.2.03.45 to 1.2.3.45 so base::Version considers it as valid. |
179 for (int i = 1; i <= 9; ++i) { | 180 for (int i = 1; i <= 9; ++i) { |
180 std::string from = base::StringPrintf(".0%d", i); | 181 std::string from = base::StringPrintf(".0%d", i); |
181 std::string to = base::StringPrintf(".%d", i); | 182 std::string to = base::StringPrintf(".%d", i); |
182 ReplaceSubstringsAfterOffset(&reader_version, 0, from, to); | 183 ReplaceSubstringsAfterOffset(&reader_version, 0, from, to); |
183 } | 184 } |
184 base::Version file_version(reader_version); | 185 base::Version file_version(reader_version); |
185 return file_version.IsValid() && !file_version.IsOlderThan(kSecureVersion); | 186 return file_version.IsValid() && !file_version.IsOlderThan(kSecureVersion); |
186 } | 187 } |
OLD | NEW |