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/installer/util/module_util_win.cc

Issue 1878313003: Convert //chrome/installer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert decompress.cc in mini_installer. 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/installer/util/module_util_win.h" 5 #include "chrome/installer/util/module_util_win.h"
6 6
7 #include <memory>
8
7 #include "base/base_paths.h" 9 #include "base/base_paths.h"
8 #include "base/file_version_info.h" 10 #include "base/file_version_info.h"
9 #include "base/files/file.h" 11 #include "base/files/file.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/version.h" 16 #include "base/version.h"
16 #include "base/win/current_module.h" 17 #include "base/win/current_module.h"
17 18
18 namespace installer { 19 namespace installer {
19 20
20 namespace { 21 namespace {
21 22
22 // Returns the version in the current executable's version resource. 23 // Returns the version in the current executable's version resource.
23 base::string16 GetCurrentExecutableVersion() { 24 base::string16 GetCurrentExecutableVersion() {
24 scoped_ptr<FileVersionInfo> file_version_info( 25 std::unique_ptr<FileVersionInfo> file_version_info(
25 FileVersionInfo::CreateFileVersionInfoForModule(CURRENT_MODULE())); 26 FileVersionInfo::CreateFileVersionInfoForModule(CURRENT_MODULE()));
26 DCHECK(file_version_info.get()); 27 DCHECK(file_version_info.get());
27 base::string16 version_string(file_version_info->file_version()); 28 base::string16 version_string(file_version_info->file_version());
28 DCHECK(base::Version(base::UTF16ToASCII(version_string)).IsValid()); 29 DCHECK(base::Version(base::UTF16ToASCII(version_string)).IsValid());
29 return version_string; 30 return version_string;
30 } 31 }
31 32
32 // Indicates whether a file can be opened using the same flags that 33 // Indicates whether a file can be opened using the same flags that
33 // ::LoadLibrary() uses to open modules. 34 // ::LoadLibrary() uses to open modules.
34 bool ModuleCanBeRead(const base::FilePath file_path) { 35 bool ModuleCanBeRead(const base::FilePath file_path) {
(...skipping 17 matching lines...) Expand all
52 53
53 // Othwerwise, return the path to the module in a versioned sub-directory of 54 // Othwerwise, return the path to the module in a versioned sub-directory of
54 // the current executable's directory. This is the expected location of 55 // the current executable's directory. This is the expected location of
55 // modules for proper installs. 56 // modules for proper installs.
56 const base::string16 version = GetCurrentExecutableVersion(); 57 const base::string16 version = GetCurrentExecutableVersion();
57 DCHECK(!version.empty()); 58 DCHECK(!version.empty());
58 return exe_dir.Append(version).Append(module_name); 59 return exe_dir.Append(version).Append(module_name);
59 } 60 }
60 61
61 } // namespace installer 62 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/master_preferences_unittest.cc ('k') | chrome/installer/util/move_tree_work_item_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698