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

Side by Side Diff: chrome/browser/geolocation/chrome_access_token_store.cc

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/geolocation/chrome_access_token_store.h" 5 #include "chrome/browser/geolocation/chrome_access_token_store.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_piece.h" 8 #include "base/string_piece.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 callback_.Run(access_token_set_, system_request_context_); 91 callback_.Run(access_token_set_, system_request_context_);
92 } 92 }
93 93
94 AccessTokenStore::LoadAccessTokensCallbackType callback_; 94 AccessTokenStore::LoadAccessTokensCallbackType callback_;
95 AccessTokenStore::AccessTokenSet access_token_set_; 95 AccessTokenStore::AccessTokenSet access_token_set_;
96 net::URLRequestContextGetter* system_request_context_; 96 net::URLRequestContextGetter* system_request_context_;
97 }; 97 };
98 98
99 } // namespace 99 } // namespace
100 100
101 void ChromeAccessTokenStore::RegisterPrefs(PrefService* prefs) { 101 void ChromeAccessTokenStore::RegisterPrefs(PrefServiceSimple* prefs) {
102 prefs->RegisterDictionaryPref(prefs::kGeolocationAccessToken); 102 prefs->RegisterDictionaryPref(prefs::kGeolocationAccessToken);
103 } 103 }
104 104
105 ChromeAccessTokenStore::ChromeAccessTokenStore() {} 105 ChromeAccessTokenStore::ChromeAccessTokenStore() {}
106 106
107 void ChromeAccessTokenStore::LoadAccessTokens( 107 void ChromeAccessTokenStore::LoadAccessTokens(
108 const LoadAccessTokensCallbackType& callback) { 108 const LoadAccessTokensCallbackType& callback) {
109 scoped_refptr<TokenLoadingJob> job(new TokenLoadingJob(callback)); 109 scoped_refptr<TokenLoadingJob> job(new TokenLoadingJob(callback));
110 job->Run(); 110 job->Run();
111 } 111 }
112 112
113 ChromeAccessTokenStore::~ChromeAccessTokenStore() {} 113 ChromeAccessTokenStore::~ChromeAccessTokenStore() {}
114 114
115 static void SetAccessTokenOnUIThread(const GURL& server_url, 115 static void SetAccessTokenOnUIThread(const GURL& server_url,
116 const string16& token) { 116 const string16& token) {
117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
118 DictionaryPrefUpdate update(g_browser_process->local_state(), 118 DictionaryPrefUpdate update(g_browser_process->local_state(),
119 prefs::kGeolocationAccessToken); 119 prefs::kGeolocationAccessToken);
120 DictionaryValue* access_token_dictionary = update.Get(); 120 DictionaryValue* access_token_dictionary = update.Get();
121 access_token_dictionary->SetWithoutPathExpansion( 121 access_token_dictionary->SetWithoutPathExpansion(
122 server_url.spec(), Value::CreateStringValue(token)); 122 server_url.spec(), Value::CreateStringValue(token));
123 } 123 }
124 124
125 void ChromeAccessTokenStore::SaveAccessToken(const GURL& server_url, 125 void ChromeAccessTokenStore::SaveAccessToken(const GURL& server_url,
126 const string16& access_token) { 126 const string16& access_token) {
127 BrowserThread::PostTask( 127 BrowserThread::PostTask(
128 BrowserThread::UI, FROM_HERE, 128 BrowserThread::UI, FROM_HERE,
129 base::Bind(&SetAccessTokenOnUIThread, server_url, access_token)); 129 base::Bind(&SetAccessTokenOnUIThread, server_url, access_token));
130 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698