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

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

Issue 4342001: Refactoring the master_preferences functions.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | chrome/installer/util/master_preferences.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/install_util.cc
===================================================================
--- chrome/installer/util/install_util.cc (revision 64604)
+++ chrome/installer/util/install_util.cc (working copy)
@@ -25,12 +25,18 @@
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/l10n_string_util.h"
-#include "chrome/installer/util/master_preferences.h"
+#include "chrome/installer/util/master_preferences_constants.h"
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/work_item_list.h"
using base::win::RegKey;
+using installer_util::MasterPreferences;
+const MasterPreferences& InstallUtil::GetMasterPreferencesForCurrentProcess() {
+ static MasterPreferences prefs(*CommandLine::ForCurrentProcess());
+ return prefs;
+}
+
bool InstallUtil::ExecuteExeAsAdmin(const std::wstring& exe,
const std::wstring& params,
DWORD* exit_code) {
@@ -132,20 +138,13 @@
}
bool InstallUtil::IsChromeFrameProcess() {
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- DCHECK(command_line)
- << "IsChromeFrameProcess() called before ComamandLine::Init()";
-
FilePath module_path;
PathService::Get(base::FILE_MODULE, &module_path);
std::wstring module_name(module_path.BaseName().value());
- scoped_ptr<DictionaryValue> prefs(installer_util::GetInstallPreferences(
- *command_line));
- DCHECK(prefs.get());
+ const MasterPreferences& prefs = GetMasterPreferencesForCurrentProcess();
bool is_cf = false;
- installer_util::GetDistroBooleanPreference(prefs.get(),
- installer_util::master_preferences::kChromeFrame, &is_cf);
+ prefs.GetBool(installer_util::master_preferences::kChromeFrame, &is_cf);
// Also assume this to be a ChromeFrame process if we are running inside
// the Chrome Frame DLL.
@@ -175,18 +174,13 @@
static bool is_msi_ = false;
static bool msi_checked_ = false;
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- CHECK(command_line);
-
if (!msi_checked_) {
msi_checked_ = true;
- scoped_ptr<DictionaryValue> prefs(installer_util::GetInstallPreferences(
- *command_line));
- DCHECK(prefs.get());
+ const MasterPreferences& prefs = GetMasterPreferencesForCurrentProcess();
+
bool is_msi = false;
- installer_util::GetDistroBooleanPreference(prefs.get(),
- installer_util::master_preferences::kMsi, &is_msi);
+ prefs.GetBool(installer_util::master_preferences::kMsi, &is_msi);
if (!is_msi) {
// We didn't find it in the preferences, try looking in the registry.
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | chrome/installer/util/master_preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698