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

Unified Diff: chrome/browser/first_run/first_run.cc

Issue 12094026: Skip a first-run import on Mac when there is nothing left to import. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove fragile check Created 7 years, 11 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/browser/first_run/first_run.h ('k') | chrome/browser/first_run/first_run_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/first_run/first_run.cc
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index b8409087ac10768f2df9019254482661e3622398..0de18c4ba121761cbc5ebb73ec62387419e12d7f 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/file_util.h"
+#include "base/lazy_instance.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/stringprintf.h"
@@ -213,9 +214,14 @@ namespace internal {
FirstRunState first_run_ = FIRST_RUN_UNKNOWN;
-installer::MasterPreferences* LoadMasterPrefs(FilePath* master_prefs_path)
-{
- *master_prefs_path = FilePath(MasterPrefsPath());
+static base::LazyInstance<FilePath> master_prefs_path_for_testing
+ = LAZY_INSTANCE_INITIALIZER;
+
+installer::MasterPreferences* LoadMasterPrefs(FilePath* master_prefs_path) {
+ if (!master_prefs_path_for_testing.Get().empty())
+ *master_prefs_path = master_prefs_path_for_testing.Get();
+ else
+ *master_prefs_path = FilePath(MasterPrefsPath());
if (master_prefs_path->empty())
return NULL;
installer::MasterPreferences* install_prefs =
@@ -547,6 +553,10 @@ void FirstRunBubbleLauncher::Observe(
delete this;
}
+void SetMasterPrefsPathForTesting(const FilePath& master_prefs) {
+ internal::master_prefs_path_for_testing.Get() = master_prefs;
+}
+
ProcessMasterPreferencesResult ProcessMasterPreferences(
const FilePath& user_data_dir,
MasterPrefs* out_prefs) {
« no previous file with comments | « chrome/browser/first_run/first_run.h ('k') | chrome/browser/first_run/first_run_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698