Chromium Code Reviews| Index: components/user_prefs/user_prefs.h |
| diff --git a/components/user_prefs/user_prefs.h b/components/user_prefs/user_prefs.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..aaae5e951c5868eae1c0f87980da5a840c3a24de |
| --- /dev/null |
| +++ b/components/user_prefs/user_prefs.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_USER_PREFS_USER_PREFS_H_ |
| +#define COMPONENTS_USER_PREFS_USER_PREFS_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "components/user_prefs/user_prefs_delegate.h" |
|
tfarina
2013/02/27 15:17:50
does scoped_ptr allow you to forward declare this?
|
| +#include "components/user_prefs/user_prefs_export.h" |
| + |
| +template <typename T> struct DefaultSingletonTraits; |
| +class PrefService; |
| + |
| +namespace content { |
| +class BrowserContext; |
| +}; |
|
tfarina
2013/02/27 15:17:50
no ; here
|
| + |
| +namespace components { |
| + |
| +// Components may use preferences associated with a given user. These |
| +// are retrieved based on content::BrowserContext. |
| +// |
| +// This singleton is initialized by embedders, to provide other |
| +// components with a means of doing this lookup. |
| +class USER_PREFS_EXPORT UserPrefs { |
| + public: |
| + static UserPrefs* GetInstance(); |
| + |
| + ~UserPrefs() {} |
|
tfarina
2013/02/27 15:17:50
can you avoid inlining?
|
| + |
| + // Must be called exactly once, before any other method calls on |
| + // this object. This object takes ownership of the delegate. |
| + void Initialize(scoped_ptr<UserPrefsDelegate> delegate); |
| + |
| + // Retrieves the PrefService for the user preferences tied to the |
| + // given BrowserContext. Returns NULL if there is no such |
| + // PrefService, or if |Initialize| has not been called. |
| + PrefService* Lookup(content::BrowserContext* context); |
| + |
| + private: |
| + UserPrefs() {} |
|
tfarina
2013/02/27 15:17:50
can you avoid inlining here?
|
| + friend struct DefaultSingletonTraits<UserPrefs>; |
|
tfarina
2013/02/27 15:17:50
can you put this first? right after private: ?
|
| + |
| + scoped_ptr<UserPrefsDelegate> delegate_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(UserPrefs); |
| +}; |
| + |
| +} // namespace components |
| + |
| +#endif // COMPONENTS_USER_PREFS_USER_PREFS_H_ |