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

Side by Side Diff: chrome/browser/chromeos/login/screens/screen_context.h

Issue 106433007: Update some uses of Value in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_CONTEXT_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_CONTEXT_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_CONTEXT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Returns true if context has |key|. 61 // Returns true if context has |key|.
62 bool HasKey(const KeyType& key) const; 62 bool HasKey(const KeyType& key) const;
63 63
64 // Returns true if there was changes since last call to 64 // Returns true if there was changes since last call to
65 // GetChangesAndReset(). 65 // GetChangesAndReset().
66 bool HasChanges() const; 66 bool HasChanges() const;
67 67
68 // Stores all changes since the last call to the 68 // Stores all changes since the last call to the
69 // GetChangesAndReset() in |diff|. All previous contents of |diff| 69 // GetChangesAndReset() in |diff|. All previous contents of |diff|
70 // will be thrown away. 70 // will be thrown away.
71 void GetChangesAndReset(DictionaryValue* diff); 71 void GetChangesAndReset(base::DictionaryValue* diff);
72 72
73 // Applies changes from |diff| to the context. All keys from |diff| 73 // Applies changes from |diff| to the context. All keys from |diff|
74 // are stored in |keys|. 74 // are stored in |keys|.
75 void ApplyChanges(const DictionaryValue& diff, 75 void ApplyChanges(const base::DictionaryValue& diff,
76 std::vector<std::string>* keys); 76 std::vector<std::string>* keys);
77 77
78 private: 78 private:
79 bool Set(const KeyType& key, Value* value); 79 bool Set(const KeyType& key, base::Value* value);
80 80
81 template<typename T> 81 template<typename T>
82 T Get(const KeyType& key) { 82 T Get(const KeyType& key) {
83 DCHECK(CalledOnValidThread()); 83 DCHECK(CalledOnValidThread());
84 const Value* value; 84 const base::Value* value;
85 bool has_key = storage_.Get(key, &value); 85 bool has_key = storage_.Get(key, &value);
86 DCHECK(has_key); 86 DCHECK(has_key);
87 T result; 87 T result;
88 if (!ParseValue<T>(value, &result)) { 88 if (!ParseValue<T>(value, &result)) {
89 NOTREACHED(); 89 NOTREACHED();
90 return T(); 90 return T();
91 } 91 }
92 return result; 92 return result;
93 } 93 }
94 94
95 template<typename T> 95 template<typename T>
96 T Get(const KeyType& key, const T& default_value) { 96 T Get(const KeyType& key, const T& default_value) {
97 DCHECK(CalledOnValidThread()); 97 DCHECK(CalledOnValidThread());
98 if (!HasKey(key)) 98 if (!HasKey(key))
99 return default_value; 99 return default_value;
100 return Get<T>(key); 100 return Get<T>(key);
101 } 101 }
102 102
103 // Contains current state of <key, value> map. 103 // Contains current state of <key, value> map.
104 DictionaryValue storage_; 104 base::DictionaryValue storage_;
105 105
106 // Contains all pending changes. 106 // Contains all pending changes.
107 DictionaryValue changes_; 107 base::DictionaryValue changes_;
108 108
109 DISALLOW_COPY_AND_ASSIGN(ScreenContext); 109 DISALLOW_COPY_AND_ASSIGN(ScreenContext);
110 }; 110 };
111 111
112 } // namespace chromeos 112 } // namespace chromeos
113 113
114 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_CONTEXT_H_ 114 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_CONTEXT_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/oauth2_browsertest.cc ('k') | chrome/browser/chromeos/login/screens/screen_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698