Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: components/login/screens/screen_context.h

Issue 755203002: Added usage of ScreenContext in EulaScreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comments. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/login/screens/screen_context.h
diff --git a/components/login/screens/screen_context.h b/components/login/screens/screen_context.h
index 6de612fbe1bd0b3e8d2c1d3ba029983f0d7055e2..bfbba12551b9cb363469886240ea33354af78876 100644
--- a/components/login/screens/screen_context.h
+++ b/components/login/screens/screen_context.h
@@ -9,9 +9,13 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/callback_list.h"
+#include "base/containers/hash_tables.h"
#include "base/containers/hash_tables.h"
#include "base/logging.h"
#include "base/memory/linked_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
#include "base/threading/non_thread_safe.h"
#include "base/values.h"
@@ -37,6 +41,10 @@ class LOGIN_EXPORT ScreenContext : public base::NonThreadSafe {
public:
typedef std::string KeyType;
typedef base::Value ValueType;
+ typedef base::Callback<void(const KeyType& key, const base::Value& value)>
+ KeyObserver;
+ typedef base::CallbackList<KeyObserver::RunType> KeyObserversList;
+ typedef KeyObserversList::Subscription KeyObserverSubscription;
ScreenContext();
~ScreenContext();
@@ -68,6 +76,10 @@ class LOGIN_EXPORT ScreenContext : public base::NonThreadSafe {
String16List GetString16List(const KeyType& key,
const String16List& default_value) const;
+ scoped_ptr<KeyObserverSubscription> AddKeyObserver(
+ const KeyType& key,
+ const KeyObserver& observer);
+
// Returns true if context has |key|.
bool HasKey(const KeyType& key) const;
@@ -119,6 +131,8 @@ class LOGIN_EXPORT ScreenContext : public base::NonThreadSafe {
// Contains all pending changes.
base::DictionaryValue changes_;
+ base::hash_map<KeyType, linked_ptr<KeyObserversList>> key_observers_;
+
DISALLOW_COPY_AND_ASSIGN(ScreenContext);
};

Powered by Google App Engine
This is Rietveld 408576698