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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 } | 497 } |
498 | 498 |
499 cus->Start(); | 499 cus->Start(); |
500 } | 500 } |
501 | 501 |
502 } // namespace | 502 } // namespace |
503 | 503 |
504 | 504 |
505 // BrowserInit ---------------------------------------------------------------- | 505 // BrowserInit ---------------------------------------------------------------- |
506 | 506 |
507 bool BrowserInit::was_restarted_ = false; | |
508 bool BrowserInit::was_restarted_read_ = false; | |
509 | |
510 BrowserInit::BrowserInit() {} | 507 BrowserInit::BrowserInit() {} |
511 | 508 |
512 BrowserInit::~BrowserInit() {} | 509 BrowserInit::~BrowserInit() {} |
513 | 510 |
514 void BrowserInit::AddFirstRunTab(const GURL& url) { | 511 void BrowserInit::AddFirstRunTab(const GURL& url) { |
515 first_run_tabs_.push_back(url); | 512 first_run_tabs_.push_back(url); |
516 } | 513 } |
517 | 514 |
518 // static | 515 // static |
519 bool BrowserInit::InProcessStartup() { | 516 bool BrowserInit::InProcessStartup() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 ->AddNetworkManagerObserver(sms_observer); | 585 ->AddNetworkManagerObserver(sms_observer); |
589 | 586 |
590 profile->SetupChromeOSEnterpriseExtensionObserver(); | 587 profile->SetupChromeOSEnterpriseExtensionObserver(); |
591 } | 588 } |
592 #endif | 589 #endif |
593 return true; | 590 return true; |
594 } | 591 } |
595 | 592 |
596 // static | 593 // static |
597 bool BrowserInit::WasRestarted() { | 594 bool BrowserInit::WasRestarted() { |
598 if (!was_restarted_read_) { | 595 // Stores the value of the preference kWasRestarted had when it was read. |
| 596 static bool was_restarted = false; |
| 597 |
| 598 // True if we have already read and reset the preference kWasRestarted. |
| 599 static bool was_restarted_read = false; |
| 600 |
| 601 if (!was_restarted_read) { |
599 PrefService* pref_service = g_browser_process->local_state(); | 602 PrefService* pref_service = g_browser_process->local_state(); |
600 was_restarted_ = pref_service->GetBoolean(prefs::kWasRestarted); | 603 was_restarted = pref_service->GetBoolean(prefs::kWasRestarted); |
601 pref_service->SetBoolean(prefs::kWasRestarted, false); | 604 pref_service->SetBoolean(prefs::kWasRestarted, false); |
602 pref_service->ScheduleSavePersistentPrefs(); | 605 pref_service->ScheduleSavePersistentPrefs(); |
603 was_restarted_read_ = true; | 606 was_restarted_read = true; |
604 } | 607 } |
605 return was_restarted_; | 608 return was_restarted; |
606 } | 609 } |
607 | 610 |
608 // BrowserInit::LaunchWithProfile::Tab ---------------------------------------- | 611 // BrowserInit::LaunchWithProfile::Tab ---------------------------------------- |
609 | 612 |
610 BrowserInit::LaunchWithProfile::Tab::Tab() : is_app(false), is_pinned(true) {} | 613 BrowserInit::LaunchWithProfile::Tab::Tab() : is_app(false), is_pinned(true) {} |
611 | 614 |
612 BrowserInit::LaunchWithProfile::Tab::~Tab() {} | 615 BrowserInit::LaunchWithProfile::Tab::~Tab() {} |
613 | 616 |
614 | 617 |
615 // BrowserInit::LaunchWithProfile --------------------------------------------- | 618 // BrowserInit::LaunchWithProfile --------------------------------------------- |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 | 1547 |
1545 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1548 Profile* profile = ProfileManager::GetLastUsedProfile(); |
1546 if (!profile) { | 1549 if (!profile) { |
1547 // We should only be able to get here if the profile already exists and | 1550 // We should only be able to get here if the profile already exists and |
1548 // has been created. | 1551 // has been created. |
1549 NOTREACHED(); | 1552 NOTREACHED(); |
1550 return; | 1553 return; |
1551 } | 1554 } |
1552 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL); | 1555 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL); |
1553 } | 1556 } |
OLD | NEW |