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

Unified Diff: chrome/install_static/install_util.h

Issue 2422643002: Windows install_static refactor. (Closed)
Patch Set: sync to position 431863 Created 4 years, 1 month 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
Index: chrome/install_static/install_util.h
diff --git a/chrome/install_static/install_util.h b/chrome/install_static/install_util.h
index 1aece7c27199fcecdfae42550204d7dae2952a12..4ded522138c89312a068eb05c9114dd39e8ea36c 100644
--- a/chrome/install_static/install_util.h
+++ b/chrome/install_static/install_util.h
@@ -1,6 +1,7 @@
// Copyright 2016 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.
+
// This file contains helper functions which provide information about the
// current version of Chrome. This includes channel information, version
// information etc. This functionality is provided by using functions in
@@ -14,26 +15,14 @@
namespace install_static {
+struct InstallConstants;
+
enum class ProcessType {
UNINITIALIZED,
NON_BROWSER_PROCESS,
BROWSER_PROCESS,
};
-// TODO(ananta)
-// https://crbug.com/604923
-// The constants defined in this file are also defined in chrome/installer and
-// other places. we need to unify them.
-extern const wchar_t kChromeChannelUnknown[];
-extern const wchar_t kChromeChannelCanary[];
-extern const wchar_t kChromeChannelDev[];
-extern const wchar_t kChromeChannelBeta[];
-extern const wchar_t kChromeChannelStable[];
-extern const wchar_t kChromeChannelStableExplicit[];
-extern const wchar_t kRegPathClientState[];
-extern const wchar_t kRegPathClientStateMedium[];
-extern const wchar_t kRegPathChromePolicy[];
-extern const wchar_t kRegApField[];
// Registry key to store the stats/crash sampling state of Chrome. If set to 1,
// stats and crash reports will be uploaded in line with the user's consent,
// otherwise, uploads will be disabled. It is used to sample clients, to reduce
@@ -41,13 +30,6 @@ extern const wchar_t kRegApField[];
// MetricsReporting feature in chrome_metrics_services_manager_client.cc and is
// written when metrics services are started up and when consent changes.
extern const wchar_t kRegValueChromeStatsSample[];
-// Used to retrieve consent for uploading crashes and metrics.
-extern const wchar_t kRegValueUsageStats[];
-extern const wchar_t kUninstallArgumentsField[];
-extern const wchar_t kMetricsReportingEnabled[];
-extern const wchar_t kAppGuidCanary[];
-extern const wchar_t kAppGuidGoogleChrome[];
-extern const wchar_t kAppGuidGoogleBinaries[];
// TODO(ananta)
// https://crbug.com/604923
@@ -67,25 +49,16 @@ extern const char kUtilityProcess[];
extern const char kProcessType[];
extern const char kCrashpadHandler[];
-// Returns true if |exe_path| points to a Chrome installed in an SxS
-// installation.
-bool IsSxSChrome(const wchar_t* exe_path);
-
-// Returns true if |exe_path| points to a per-user level Chrome installation.
-bool IsSystemInstall(const wchar_t* exe_path);
+// Returns true if Chrome is running at system level.
+bool IsSystemInstall();
// Returns true if current installation of Chrome is a multi-install.
-bool IsMultiInstall(bool is_system_install);
+bool IsMultiInstall();
// Returns true if usage stats collecting is enabled for this user for the
// current executable.
bool GetCollectStatsConsent();
-// Returns true if usage stats collecting is enabled for this user for the
-// executable passed in as |exe_path|.
-// Only used by tests.
-bool GetCollectStatsConsentForTesting(const std::wstring& exe_path);
-
// Returns true if the current executable is currently in the chosen sample that
// will report stats and crashes.
bool GetCollectStatsInSample();
@@ -126,7 +99,7 @@ bool GetDefaultCrashDumpLocation(std::wstring* crash_dir);
// block of the calling process. Returns an empty string if the variable does
// not exist.
std::string GetEnvironmentString(const std::string& variable_name);
-std::wstring GetEnvironmentString16(const std::wstring& variable_name);
+std::wstring GetEnvironmentString16(const wchar_t* variable_name);
// Sets the environment variable identified by |variable_name| to the value
// identified by |new_value|.
@@ -146,7 +119,7 @@ bool HasEnvironmentVariable16(const std::wstring& variable_name);
// TODO(ananta)
// http://crbug.com/604923
// Unify this with the Browser Distribution code.
-bool GetExecutableVersionDetails(const std::wstring& exe_path,
+void GetExecutableVersionDetails(const std::wstring& exe_path,
std::wstring* product_name,
std::wstring* version,
std::wstring* special_build,
@@ -159,22 +132,7 @@ bool GetExecutableVersionDetails(const std::wstring& exe_path,
// TODO(ananta)
// http://crbug.com/604923
// Unify this with the Browser Distribution code.
-void GetChromeChannelName(bool is_per_user_install,
- bool add_modifier,
- std::wstring* channel_name);
-
-// Returns the version of Google Update that is installed.
-// TODO(ananta)
-// http://crbug.com/604923
-// Unify this with the Browser Distribution code.
-std::string GetGoogleUpdateVersion();
-
-// Returns the Chrome installation subdirectory, i.e. Google Chrome\Chromium,
-// etc.
-// TODO(ananta)
-// http://crbug.com/604923
-// Unify this with the Browser Distribution code.
-std::wstring GetChromeInstallSubDirectory();
+std::wstring GetChromeChannelName(bool add_modifier);
// Returns the registry path where the browser crash dumps metrics need to be
// written to.
@@ -207,22 +165,18 @@ std::vector<std::wstring> TokenizeString16(const std::wstring& str,
wchar_t delimiter,
bool trim_spaces);
-// Compares version strings of the form "X.X.X.X" and returns the result of the
-// comparison in the |result| parameter. The result is as below:
-// 0 if the versions are equal.
-// -1 if version1 < version2.
-// 1 if version1 > version2.
-// Returns true on success, false on invalid strings being passed, etc.
-bool CompareVersionStrings(const std::string& version1,
- const std::string& version2,
- int* result);
-
// We assume that the command line |command_line| contains multiple switches
// with the format --<switch name>=<switch value>. This function returns the
// value of the |switch_name| passed in.
std::string GetSwitchValueFromCommandLine(const std::string& command_line,
const std::string& switch_name);
+// Returns the unadorned channel name based on the channel strategy for the
+// install mode.
+std::wstring DetermineChannel(const InstallConstants& mode,
+ bool system_level,
+ bool multi_install);
+
// Caches the |ProcessType| of the current process.
extern ProcessType g_process_type;

Powered by Google App Engine
This is Rietveld 408576698