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/ui/browser_init.h" | 5 #include "chrome/browser/ui/browser_init.h" |
6 | 6 |
7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 g_browser_process->crl_set_fetcher()->StartInitialLoad(cus); | 491 g_browser_process->crl_set_fetcher()->StartInitialLoad(cus); |
492 | 492 |
493 cus->Start(); | 493 cus->Start(); |
494 } | 494 } |
495 | 495 |
496 } // namespace | 496 } // namespace |
497 | 497 |
498 | 498 |
499 // BrowserInit ---------------------------------------------------------------- | 499 // BrowserInit ---------------------------------------------------------------- |
500 | 500 |
| 501 bool BrowserInit::was_restarted_ = false; |
| 502 bool BrowserInit::was_restarted_read_ = false; |
| 503 |
501 BrowserInit::BrowserInit() {} | 504 BrowserInit::BrowserInit() {} |
502 | 505 |
503 BrowserInit::~BrowserInit() {} | 506 BrowserInit::~BrowserInit() {} |
504 | 507 |
505 void BrowserInit::AddFirstRunTab(const GURL& url) { | 508 void BrowserInit::AddFirstRunTab(const GURL& url) { |
506 first_run_tabs_.push_back(url); | 509 first_run_tabs_.push_back(url); |
507 } | 510 } |
508 | 511 |
509 // static | 512 // static |
510 bool BrowserInit::InProcessStartup() { | 513 bool BrowserInit::InProcessStartup() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 ->AddNetworkManagerObserver(sms_observer); | 582 ->AddNetworkManagerObserver(sms_observer); |
580 | 583 |
581 profile->SetupChromeOSEnterpriseExtensionObserver(); | 584 profile->SetupChromeOSEnterpriseExtensionObserver(); |
582 } | 585 } |
583 #endif | 586 #endif |
584 return true; | 587 return true; |
585 } | 588 } |
586 | 589 |
587 // static | 590 // static |
588 bool BrowserInit::WasRestarted() { | 591 bool BrowserInit::WasRestarted() { |
589 // Stores the value of the preference kWasRestarted had when it was read. | 592 if (!was_restarted_read_) { |
590 static bool was_restarted = false; | |
591 | |
592 // True if we have already read and reset the preference kWasRestarted. | |
593 static bool was_restarted_read = false; | |
594 | |
595 if (!was_restarted_read) { | |
596 PrefService* pref_service = g_browser_process->local_state(); | 593 PrefService* pref_service = g_browser_process->local_state(); |
597 was_restarted = pref_service->GetBoolean(prefs::kWasRestarted); | 594 was_restarted_ = pref_service->GetBoolean(prefs::kWasRestarted); |
598 pref_service->SetBoolean(prefs::kWasRestarted, false); | 595 pref_service->SetBoolean(prefs::kWasRestarted, false); |
599 pref_service->ScheduleSavePersistentPrefs(); | 596 pref_service->ScheduleSavePersistentPrefs(); |
600 was_restarted_read = true; | 597 was_restarted_read_ = true; |
601 } | 598 } |
602 return was_restarted; | 599 return was_restarted_; |
603 } | 600 } |
604 | 601 |
605 // BrowserInit::LaunchWithProfile::Tab ---------------------------------------- | 602 // BrowserInit::LaunchWithProfile::Tab ---------------------------------------- |
606 | 603 |
607 BrowserInit::LaunchWithProfile::Tab::Tab() : is_app(false), is_pinned(true) {} | 604 BrowserInit::LaunchWithProfile::Tab::Tab() : is_app(false), is_pinned(true) {} |
608 | 605 |
609 BrowserInit::LaunchWithProfile::Tab::~Tab() {} | 606 BrowserInit::LaunchWithProfile::Tab::~Tab() {} |
610 | 607 |
611 | 608 |
612 // BrowserInit::LaunchWithProfile --------------------------------------------- | 609 // BrowserInit::LaunchWithProfile --------------------------------------------- |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 | 1538 |
1542 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1539 Profile* profile = ProfileManager::GetLastUsedProfile(); |
1543 if (!profile) { | 1540 if (!profile) { |
1544 // We should only be able to get here if the profile already exists and | 1541 // We should only be able to get here if the profile already exists and |
1545 // has been created. | 1542 // has been created. |
1546 NOTREACHED(); | 1543 NOTREACHED(); |
1547 return; | 1544 return; |
1548 } | 1545 } |
1549 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL); | 1546 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL); |
1550 } | 1547 } |
OLD | NEW |