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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
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 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 reader_info.is_secure = false; 74 reader_info.is_secure = false;
75 75
76 PluginFinder* plugin_finder = PluginFinder::GetInstance(); 76 PluginFinder* plugin_finder = PluginFinder::GetInstance();
77 for (size_t i = 0; i < plugins.size(); ++i) { 77 for (size_t i = 0; i < plugins.size(); ++i) {
78 const content::WebPluginInfo& plugin = plugins[i]; 78 const content::WebPluginInfo& plugin = plugins[i];
79 if (plugin.is_pepper_plugin()) 79 if (plugin.is_pepper_plugin())
80 continue; 80 continue;
81 if (std::find_if(plugin.mime_types.begin(), plugin.mime_types.end(), 81 if (std::find_if(plugin.mime_types.begin(), plugin.mime_types.end(),
82 IsPdfMimeType) == plugin.mime_types.end()) 82 IsPdfMimeType) == plugin.mime_types.end())
83 continue; 83 continue;
84 scoped_ptr<PluginMetadata> plugin_metadata( 84 std::unique_ptr<PluginMetadata> plugin_metadata(
85 plugin_finder->GetPluginMetadata(plugins[i])); 85 plugin_finder->GetPluginMetadata(plugins[i]));
86 if (plugin_metadata->identifier() != kAdobeReaderIdentifier) 86 if (plugin_metadata->identifier() != kAdobeReaderIdentifier)
87 continue; 87 continue;
88 88
89 reader_info.is_installed = true; 89 reader_info.is_installed = true;
90 90
91 if (profile) { 91 if (profile) {
92 scoped_refptr<PluginPrefs> plugin_prefs = 92 scoped_refptr<PluginPrefs> plugin_prefs =
93 PluginPrefs::GetForProfile(profile); 93 PluginPrefs::GetForProfile(profile);
94 PluginPrefs::PolicyStatus plugin_status = 94 PluginPrefs::PolicyStatus plugin_status =
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 bool IsAdobeReaderDefaultPDFViewer() { 163 bool IsAdobeReaderDefaultPDFViewer() {
164 return IsAdobeReaderDefaultPDFViewerInternal(NULL); 164 return IsAdobeReaderDefaultPDFViewerInternal(NULL);
165 } 165 }
166 166
167 bool IsAdobeReaderUpToDate() { 167 bool IsAdobeReaderUpToDate() {
168 base::FilePath install_path; 168 base::FilePath install_path;
169 bool is_default = IsAdobeReaderDefaultPDFViewerInternal(&install_path); 169 bool is_default = IsAdobeReaderDefaultPDFViewerInternal(&install_path);
170 if (!is_default) 170 if (!is_default)
171 return false; 171 return false;
172 172
173 scoped_ptr<FileVersionInfo> file_version_info( 173 std::unique_ptr<FileVersionInfo> file_version_info(
174 FileVersionInfo::CreateFileVersionInfo(install_path)); 174 FileVersionInfo::CreateFileVersionInfo(install_path));
175 if (!file_version_info) 175 if (!file_version_info)
176 return false; 176 return false;
177 177
178 std::string reader_version = 178 std::string reader_version =
179 base::UTF16ToUTF8(file_version_info->product_version()); 179 base::UTF16ToUTF8(file_version_info->product_version());
180 // Convert 1.2.03.45 to 1.2.3.45 so base::Version considers it as valid. 180 // Convert 1.2.03.45 to 1.2.3.45 so base::Version considers it as valid.
181 for (int i = 1; i <= 9; ++i) { 181 for (int i = 1; i <= 9; ++i) {
182 std::string from = base::StringPrintf(".0%d", i); 182 std::string from = base::StringPrintf(".0%d", i);
183 std::string to = base::StringPrintf(".%d", i); 183 std::string to = base::StringPrintf(".%d", i);
184 base::ReplaceSubstringsAfterOffset(&reader_version, 0, from, to); 184 base::ReplaceSubstringsAfterOffset(&reader_version, 0, from, to);
185 } 185 }
186 base::Version file_version(reader_version); 186 base::Version file_version(reader_version);
187 return file_version.IsValid() && 187 return file_version.IsValid() &&
188 file_version >= base::Version(kSecureVersion); 188 file_version >= base::Version(kSecureVersion);
189 } 189 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/passwords/passwords_client_ui_delegate.h ('k') | chrome/browser/ui/pdf/pdf_unsupported_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698