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

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

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix double registration in Chrome Frame test. Created 7 years, 10 months 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"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/prefs/pref_registry_simple.h"
12 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/prefs/scoped_user_pref_update.h" 14 #include "chrome/browser/prefs/scoped_user_pref_update.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
17 18
18 using content::AccessTokenStore; 19 using content::AccessTokenStore;
19 using content::BrowserThread; 20 using content::BrowserThread;
20 21
21 namespace { 22 namespace {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 callback_.Run(access_token_set_, system_request_context_); 92 callback_.Run(access_token_set_, system_request_context_);
92 } 93 }
93 94
94 AccessTokenStore::LoadAccessTokensCallbackType callback_; 95 AccessTokenStore::LoadAccessTokensCallbackType callback_;
95 AccessTokenStore::AccessTokenSet access_token_set_; 96 AccessTokenStore::AccessTokenSet access_token_set_;
96 net::URLRequestContextGetter* system_request_context_; 97 net::URLRequestContextGetter* system_request_context_;
97 }; 98 };
98 99
99 } // namespace 100 } // namespace
100 101
101 void ChromeAccessTokenStore::RegisterPrefs(PrefServiceSimple* prefs) { 102 void ChromeAccessTokenStore::RegisterPrefs(PrefRegistrySimple* registry) {
102 prefs->RegisterDictionaryPref(prefs::kGeolocationAccessToken); 103 registry->RegisterDictionaryPref(prefs::kGeolocationAccessToken);
103 } 104 }
104 105
105 ChromeAccessTokenStore::ChromeAccessTokenStore() {} 106 ChromeAccessTokenStore::ChromeAccessTokenStore() {}
106 107
107 void ChromeAccessTokenStore::LoadAccessTokens( 108 void ChromeAccessTokenStore::LoadAccessTokens(
108 const LoadAccessTokensCallbackType& callback) { 109 const LoadAccessTokensCallbackType& callback) {
109 scoped_refptr<TokenLoadingJob> job(new TokenLoadingJob(callback)); 110 scoped_refptr<TokenLoadingJob> job(new TokenLoadingJob(callback));
110 job->Run(); 111 job->Run();
111 } 112 }
112 113
113 ChromeAccessTokenStore::~ChromeAccessTokenStore() {} 114 ChromeAccessTokenStore::~ChromeAccessTokenStore() {}
114 115
115 static void SetAccessTokenOnUIThread(const GURL& server_url, 116 static void SetAccessTokenOnUIThread(const GURL& server_url,
116 const string16& token) { 117 const string16& token) {
117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
118 DictionaryPrefUpdate update(g_browser_process->local_state(), 119 DictionaryPrefUpdate update(g_browser_process->local_state(),
119 prefs::kGeolocationAccessToken); 120 prefs::kGeolocationAccessToken);
120 DictionaryValue* access_token_dictionary = update.Get(); 121 DictionaryValue* access_token_dictionary = update.Get();
121 access_token_dictionary->SetWithoutPathExpansion( 122 access_token_dictionary->SetWithoutPathExpansion(
122 server_url.spec(), Value::CreateStringValue(token)); 123 server_url.spec(), Value::CreateStringValue(token));
123 } 124 }
124 125
125 void ChromeAccessTokenStore::SaveAccessToken(const GURL& server_url, 126 void ChromeAccessTokenStore::SaveAccessToken(const GURL& server_url,
126 const string16& access_token) { 127 const string16& access_token) {
127 BrowserThread::PostTask( 128 BrowserThread::PostTask(
128 BrowserThread::UI, FROM_HERE, 129 BrowserThread::UI, FROM_HERE,
129 base::Bind(&SetAccessTokenOnUIThread, server_url, access_token)); 130 base::Bind(&SetAccessTokenOnUIThread, server_url, access_token));
130 } 131 }
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/chrome_access_token_store.h ('k') | chrome/browser/geolocation/geolocation_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698