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

Unified Diff: chrome/installer/util/module_util_win.cc

Issue 2656443002: Use chrome::kChromeVersion in installer::GetModulePath(). (Closed)
Patch Set: rebase Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/module_util_win.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/module_util_win.cc
diff --git a/chrome/installer/util/module_util_win.cc b/chrome/installer/util/module_util_win.cc
deleted file mode 100644
index 2ed551319da19b086ece7e40c443b95e5da2d37e..0000000000000000000000000000000000000000
--- a/chrome/installer/util/module_util_win.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/installer/util/module_util_win.h"
-
-#include <memory>
-
-#include "base/base_paths.h"
-#include "base/file_version_info.h"
-#include "base/files/file.h"
-#include "base/logging.h"
-#include "base/path_service.h"
-#include "base/strings/string16.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/version.h"
-#include "base/win/current_module.h"
-
-namespace installer {
-
-namespace {
-
-// Returns the version in the current executable's version resource.
-base::string16 GetCurrentExecutableVersion() {
- std::unique_ptr<FileVersionInfo> file_version_info(
- FileVersionInfo::CreateFileVersionInfoForModule(CURRENT_MODULE()));
- DCHECK(file_version_info.get());
- base::string16 version_string(file_version_info->file_version());
- DCHECK(base::Version(base::UTF16ToASCII(version_string)).IsValid());
- return version_string;
-}
-
-// Indicates whether a file can be opened using the same flags that
-// ::LoadLibrary() uses to open modules.
-bool ModuleCanBeRead(const base::FilePath file_path) {
- return base::File(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ)
- .IsValid();
-}
-
-} // namespace
-
-base::FilePath GetModulePath(base::StringPiece16 module_name) {
- base::FilePath exe_dir;
- const bool has_path = base::PathService::Get(base::DIR_EXE, &exe_dir);
- DCHECK(has_path);
-
- // Look for the module in the current executable's directory and return the
- // path if it can be read. This is the expected location of modules for dev
- // builds.
- const base::FilePath module_path = exe_dir.Append(module_name);
- if (ModuleCanBeRead(module_path))
- return module_path;
-
- // Othwerwise, return the path to the module in a versioned sub-directory of
- // the current executable's directory. This is the expected location of
- // modules for proper installs.
- const base::string16 version = GetCurrentExecutableVersion();
- DCHECK(!version.empty());
- return exe_dir.Append(version).Append(module_name);
-}
-
-} // namespace installer
« no previous file with comments | « chrome/installer/util/module_util_win.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698