Chromium Code Reviews| 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 | |
| 504 BrowserInit::BrowserInit() {} | 501 BrowserInit::BrowserInit() {} |
| 505 | 502 |
| 506 BrowserInit::~BrowserInit() {} | 503 BrowserInit::~BrowserInit() {} |
| 507 | 504 |
| 508 void BrowserInit::AddFirstRunTab(const GURL& url) { | 505 void BrowserInit::AddFirstRunTab(const GURL& url) { |
| 509 first_run_tabs_.push_back(url); | 506 first_run_tabs_.push_back(url); |
| 510 } | 507 } |
| 511 | 508 |
| 512 // static | 509 // static |
| 513 bool BrowserInit::InProcessStartup() { | 510 bool BrowserInit::InProcessStartup() { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 582 ->AddNetworkManagerObserver(sms_observer); | 579 ->AddNetworkManagerObserver(sms_observer); |
| 583 | 580 |
| 584 profile->SetupChromeOSEnterpriseExtensionObserver(); | 581 profile->SetupChromeOSEnterpriseExtensionObserver(); |
| 585 } | 582 } |
| 586 #endif | 583 #endif |
| 587 return true; | 584 return true; |
| 588 } | 585 } |
| 589 | 586 |
| 590 // static | 587 // static |
| 591 bool BrowserInit::WasRestarted() { | 588 bool BrowserInit::WasRestarted() { |
| 589 // Stores the value of the preference kWasRestarted had when it was read. | |
| 590 static bool was_restarted_ = false; | |
|
sky
2011/12/14 15:22:21
Since you're moving these to locals, don't end the
marja
2011/12/15 09:21:32
Done.
| |
| 591 | |
| 592 // True if we have already read and reset the preference kWasRestarted. | |
| 593 static bool was_restarted_read_ = false; | |
| 594 | |
| 592 if (!was_restarted_read_) { | 595 if (!was_restarted_read_) { |
| 593 PrefService* pref_service = g_browser_process->local_state(); | 596 PrefService* pref_service = g_browser_process->local_state(); |
| 594 was_restarted_ = pref_service->GetBoolean(prefs::kWasRestarted); | 597 was_restarted_ = pref_service->GetBoolean(prefs::kWasRestarted); |
| 595 pref_service->SetBoolean(prefs::kWasRestarted, false); | 598 pref_service->SetBoolean(prefs::kWasRestarted, false); |
| 596 pref_service->ScheduleSavePersistentPrefs(); | 599 pref_service->ScheduleSavePersistentPrefs(); |
| 597 was_restarted_read_ = true; | 600 was_restarted_read_ = true; |
| 598 } | 601 } |
| 599 return was_restarted_; | 602 return was_restarted_; |
| 600 } | 603 } |
| 601 | 604 |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1538 | 1541 |
| 1539 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1542 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 1540 if (!profile) { | 1543 if (!profile) { |
| 1541 // We should only be able to get here if the profile already exists and | 1544 // We should only be able to get here if the profile already exists and |
| 1542 // has been created. | 1545 // has been created. |
| 1543 NOTREACHED(); | 1546 NOTREACHED(); |
| 1544 return; | 1547 return; |
| 1545 } | 1548 } |
| 1546 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL); | 1549 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL); |
| 1547 } | 1550 } |
| OLD | NEW |