OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/user_prefs/user_prefs.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/memory/singleton.h" |
| 9 |
| 10 namespace components { |
| 11 |
| 12 UserPrefs::UserPrefs() { |
| 13 } |
| 14 |
| 15 UserPrefs::~UserPrefs() { |
| 16 } |
| 17 |
| 18 // static |
| 19 UserPrefs* UserPrefs::GetInstance() { |
| 20 return Singleton<UserPrefs>::get(); |
| 21 } |
| 22 |
| 23 // static |
| 24 PrefService* UserPrefs::Get(content::BrowserContext* context) { |
| 25 return GetInstance()->Lookup(context); |
| 26 } |
| 27 |
| 28 bool UserPrefs::IsInitialized() const { |
| 29 return delegate_.get() != NULL; |
| 30 } |
| 31 |
| 32 void UserPrefs::Initialize(scoped_ptr<UserPrefsDelegate> delegate) { |
| 33 DCHECK(!delegate_.get()); |
| 34 delegate_ = delegate.Pass(); |
| 35 } |
| 36 |
| 37 PrefService* UserPrefs::Lookup(content::BrowserContext* context) { |
| 38 return delegate_->PrefServiceFromBrowserContext(context); |
| 39 } |
| 40 |
| 41 } // namespace components |
OLD | NEW |