| OLD | NEW |
| 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 Loading... |
| 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::SetOEMFirstRunBubblePref() { | 405 bool FirstRun::SetOEMFirstRunBubblePref() { |
| 400 PrefService* local_state = g_browser_process->local_state(); | 406 PrefService* local_state = g_browser_process->local_state(); |
| 401 if (!local_state) | 407 if (!local_state) |
| 402 return false; | 408 return false; |
| 403 if (!local_state->FindPreference(prefs::kShouldUseOEMFirstRunBubble)) { | 409 if (!local_state->FindPreference(prefs::kShouldUseOEMFirstRunBubble)) { |
| 404 local_state->RegisterBooleanPref(prefs::kShouldUseOEMFirstRunBubble, | 410 local_state->RegisterBooleanPref(prefs::kShouldUseOEMFirstRunBubble, |
| 405 false); | 411 false, |
| 412 false /* don't sync pref */); |
| 406 local_state->SetBoolean(prefs::kShouldUseOEMFirstRunBubble, true); | 413 local_state->SetBoolean(prefs::kShouldUseOEMFirstRunBubble, true); |
| 407 } | 414 } |
| 408 return true; | 415 return true; |
| 409 } | 416 } |
| 410 | 417 |
| 411 // static | 418 // static |
| 412 bool FirstRun::SetMinimalFirstRunBubblePref() { | 419 bool FirstRun::SetMinimalFirstRunBubblePref() { |
| 413 PrefService* local_state = g_browser_process->local_state(); | 420 PrefService* local_state = g_browser_process->local_state(); |
| 414 if (!local_state) | 421 if (!local_state) |
| 415 return false; | 422 return false; |
| 416 if (!local_state->FindPreference(prefs::kShouldUseMinimalFirstRunBubble)) { | 423 if (!local_state->FindPreference(prefs::kShouldUseMinimalFirstRunBubble)) { |
| 417 local_state->RegisterBooleanPref(prefs::kShouldUseMinimalFirstRunBubble, | 424 local_state->RegisterBooleanPref(prefs::kShouldUseMinimalFirstRunBubble, |
| 418 false); | 425 false, |
| 426 false /* don't sync pref */); |
| 419 local_state->SetBoolean(prefs::kShouldUseMinimalFirstRunBubble, true); | 427 local_state->SetBoolean(prefs::kShouldUseMinimalFirstRunBubble, true); |
| 420 } | 428 } |
| 421 return true; | 429 return true; |
| 422 } | 430 } |
| 423 | 431 |
| 424 // static | 432 // static |
| 425 int FirstRun::ImportFromFile(Profile* profile, const CommandLine& cmdline) { | 433 int FirstRun::ImportFromFile(Profile* profile, const CommandLine& cmdline) { |
| 426 FilePath file_path = cmdline.GetSwitchValuePath(switches::kImportFromFile); | 434 FilePath file_path = cmdline.GetSwitchValuePath(switches::kImportFromFile); |
| 427 if (file_path.empty()) { | 435 if (file_path.empty()) { |
| 428 NOTREACHED(); | 436 NOTREACHED(); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 if (!observer->ended()) { | 647 if (!observer->ended()) { |
| 640 observer->set_should_quit_message_loop(); | 648 observer->set_should_quit_message_loop(); |
| 641 MessageLoop::current()->Run(); | 649 MessageLoop::current()->Run(); |
| 642 } | 650 } |
| 643 | 651 |
| 644 // Unfortunately there's no success/fail signal in ImporterHost. | 652 // Unfortunately there's no success/fail signal in ImporterHost. |
| 645 return true; | 653 return true; |
| 646 } | 654 } |
| 647 | 655 |
| 648 #endif // OS_POSIX | 656 #endif // OS_POSIX |
| OLD | NEW |