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

Side by Side Diff: chrome/browser/first_run/first_run.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + comments Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/first_run/first_run.h" 5 #include "chrome/browser/first_run/first_run.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 return false; 356 return false;
357 return file_util::WriteFile(first_run_sentinel, "", 0) != -1; 357 return file_util::WriteFile(first_run_sentinel, "", 0) != -1;
358 } 358 }
359 359
360 // static 360 // static
361 bool FirstRun::SetShowFirstRunBubblePref(bool show_bubble) { 361 bool FirstRun::SetShowFirstRunBubblePref(bool show_bubble) {
362 PrefService* local_state = g_browser_process->local_state(); 362 PrefService* local_state = g_browser_process->local_state();
363 if (!local_state) 363 if (!local_state)
364 return false; 364 return false;
365 if (!local_state->FindPreference(prefs::kShouldShowFirstRunBubble)) { 365 if (!local_state->FindPreference(prefs::kShouldShowFirstRunBubble)) {
366 local_state->RegisterBooleanPref(prefs::kShouldShowFirstRunBubble, false); 366 local_state->RegisterBooleanPref(prefs::kShouldShowFirstRunBubble,
367 false,
368 false /* don't sync pref */);
367 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, show_bubble); 369 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, show_bubble);
368 } 370 }
369 return true; 371 return true;
370 } 372 }
371 373
372 // static 374 // static
373 bool FirstRun::SetShowWelcomePagePref() { 375 bool FirstRun::SetShowWelcomePagePref() {
374 PrefService* local_state = g_browser_process->local_state(); 376 PrefService* local_state = g_browser_process->local_state();
375 if (!local_state) 377 if (!local_state)
376 return false; 378 return false;
377 if (!local_state->FindPreference(prefs::kShouldShowWelcomePage)) { 379 if (!local_state->FindPreference(prefs::kShouldShowWelcomePage)) {
378 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); 380 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage,
381 false,
382 false /* don't sync pref */);
379 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); 383 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true);
380 } 384 }
381 return true; 385 return true;
382 } 386 }
383 387
384 // static 388 // static
385 bool FirstRun::SetPersonalDataManagerFirstRunPref() { 389 bool FirstRun::SetPersonalDataManagerFirstRunPref() {
386 PrefService* local_state = g_browser_process->local_state(); 390 PrefService* local_state = g_browser_process->local_state();
387 if (!local_state) 391 if (!local_state)
388 return false; 392 return false;
389 if (!local_state->FindPreference( 393 if (!local_state->FindPreference(
390 prefs::kAutofillPersonalDataManagerFirstRun)) { 394 prefs::kAutofillPersonalDataManagerFirstRun)) {
391 local_state->RegisterBooleanPref( 395 local_state->RegisterBooleanPref(
392 prefs::kAutofillPersonalDataManagerFirstRun, false); 396 prefs::kAutofillPersonalDataManagerFirstRun,
397 false,
398 false /* don't sync pref */);
393 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true); 399 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true);
394 } 400 }
395 return true; 401 return true;
396 } 402 }
397 403
398 // static 404 // static
399 bool FirstRun::SearchEngineSelectorDisallowed() { 405 bool FirstRun::SearchEngineSelectorDisallowed() {
400 // For now, the only case in which the search engine dialog should never be 406 // For now, the only case in which the search engine dialog should never be
401 // shown is if the locale is Russia. 407 // shown is if the locale is Russia.
402 std::string locale = g_browser_process->GetApplicationLocale(); 408 std::string locale = g_browser_process->GetApplicationLocale();
403 return (locale == "ru"); 409 return (locale == "ru");
404 } 410 }
405 411
406 // static 412 // static
407 bool FirstRun::SetOEMFirstRunBubblePref() { 413 bool FirstRun::SetOEMFirstRunBubblePref() {
408 PrefService* local_state = g_browser_process->local_state(); 414 PrefService* local_state = g_browser_process->local_state();
409 if (!local_state) 415 if (!local_state)
410 return false; 416 return false;
411 if (!local_state->FindPreference(prefs::kShouldUseOEMFirstRunBubble)) { 417 if (!local_state->FindPreference(prefs::kShouldUseOEMFirstRunBubble)) {
412 local_state->RegisterBooleanPref(prefs::kShouldUseOEMFirstRunBubble, 418 local_state->RegisterBooleanPref(prefs::kShouldUseOEMFirstRunBubble,
413 false); 419 false,
420 false /* don't sync pref */);
414 local_state->SetBoolean(prefs::kShouldUseOEMFirstRunBubble, true); 421 local_state->SetBoolean(prefs::kShouldUseOEMFirstRunBubble, true);
415 } 422 }
416 return true; 423 return true;
417 } 424 }
418 425
419 // static 426 // static
420 bool FirstRun::SetMinimalFirstRunBubblePref() { 427 bool FirstRun::SetMinimalFirstRunBubblePref() {
421 PrefService* local_state = g_browser_process->local_state(); 428 PrefService* local_state = g_browser_process->local_state();
422 if (!local_state) 429 if (!local_state)
423 return false; 430 return false;
424 if (!local_state->FindPreference(prefs::kShouldUseMinimalFirstRunBubble)) { 431 if (!local_state->FindPreference(prefs::kShouldUseMinimalFirstRunBubble)) {
425 local_state->RegisterBooleanPref(prefs::kShouldUseMinimalFirstRunBubble, 432 local_state->RegisterBooleanPref(prefs::kShouldUseMinimalFirstRunBubble,
426 false); 433 false,
434 false /* don't sync pref */);
427 local_state->SetBoolean(prefs::kShouldUseMinimalFirstRunBubble, true); 435 local_state->SetBoolean(prefs::kShouldUseMinimalFirstRunBubble, true);
428 } 436 }
429 return true; 437 return true;
430 } 438 }
431 439
432 // static 440 // static
433 int FirstRun::ImportFromFile(Profile* profile, const CommandLine& cmdline) { 441 int FirstRun::ImportFromFile(Profile* profile, const CommandLine& cmdline) {
434 FilePath file_path = cmdline.GetSwitchValuePath(switches::kImportFromFile); 442 FilePath file_path = cmdline.GetSwitchValuePath(switches::kImportFromFile);
435 if (file_path.empty()) { 443 if (file_path.empty()) {
436 NOTREACHED(); 444 NOTREACHED();
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 if (!observer->ended()) { 655 if (!observer->ended()) {
648 observer->set_should_quit_message_loop(); 656 observer->set_should_quit_message_loop();
649 MessageLoop::current()->Run(); 657 MessageLoop::current()->Run();
650 } 658 }
651 659
652 // Unfortunately there's no success/fail signal in ImporterHost. 660 // Unfortunately there's no success/fail signal in ImporterHost.
653 return true; 661 return true;
654 } 662 }
655 663
656 #endif // OS_POSIX 664 #endif // OS_POSIX
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698