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

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

Issue 10071036: RefCounted types should not have public destructors, chrome/browser/ part 6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation fixes Created 8 years, 8 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"
(...skipping 25 matching lines...) Expand all
36 36
37 void Run() { 37 void Run() {
38 BrowserThread::PostTaskAndReply( 38 BrowserThread::PostTaskAndReply(
39 BrowserThread::UI, 39 BrowserThread::UI,
40 FROM_HERE, 40 FROM_HERE,
41 base::Bind(&TokenLoadingJob::PerformWorkOnUIThread, this), 41 base::Bind(&TokenLoadingJob::PerformWorkOnUIThread, this),
42 base::Bind(&TokenLoadingJob::RespondOnOriginatingThread, this)); 42 base::Bind(&TokenLoadingJob::RespondOnOriginatingThread, this));
43 } 43 }
44 44
45 private: 45 private:
46 friend class base::RefCountedThreadSafe<TokenLoadingJob>;
47
48 ~TokenLoadingJob() {}
49
46 void PerformWorkOnUIThread() { 50 void PerformWorkOnUIThread() {
47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
48 DictionaryPrefUpdate update(g_browser_process->local_state(), 52 DictionaryPrefUpdate update(g_browser_process->local_state(),
49 prefs::kGeolocationAccessToken); 53 prefs::kGeolocationAccessToken);
50 DictionaryValue* token_dictionary = update.Get(); 54 DictionaryValue* token_dictionary = update.Get();
51 55
52 bool has_old_network_provider_url = false; 56 bool has_old_network_provider_url = false;
53 // The dictionary value could be NULL if the pref has never been set. 57 // The dictionary value could be NULL if the pref has never been set.
54 if (token_dictionary != NULL) { 58 if (token_dictionary != NULL) {
55 for (DictionaryValue::key_iterator it = token_dictionary->begin_keys(); 59 for (DictionaryValue::key_iterator it = token_dictionary->begin_keys();
(...skipping 24 matching lines...) Expand all
80 AccessTokenStore::AccessTokenSet access_token_set_; 84 AccessTokenStore::AccessTokenSet access_token_set_;
81 net::URLRequestContextGetter* system_request_context_; 85 net::URLRequestContextGetter* system_request_context_;
82 }; 86 };
83 87
84 } // namespace 88 } // namespace
85 89
86 void ChromeAccessTokenStore::RegisterPrefs(PrefService* prefs) { 90 void ChromeAccessTokenStore::RegisterPrefs(PrefService* prefs) {
87 prefs->RegisterDictionaryPref(prefs::kGeolocationAccessToken); 91 prefs->RegisterDictionaryPref(prefs::kGeolocationAccessToken);
88 } 92 }
89 93
90 ChromeAccessTokenStore::ChromeAccessTokenStore() { 94 ChromeAccessTokenStore::ChromeAccessTokenStore() {}
91 }
92
93 ChromeAccessTokenStore::~ChromeAccessTokenStore() {
94 }
95 95
96 void ChromeAccessTokenStore::LoadAccessTokens( 96 void ChromeAccessTokenStore::LoadAccessTokens(
97 const LoadAccessTokensCallbackType& callback) { 97 const LoadAccessTokensCallbackType& callback) {
98 scoped_refptr<TokenLoadingJob> job(new TokenLoadingJob(callback)); 98 scoped_refptr<TokenLoadingJob> job(new TokenLoadingJob(callback));
99 job->Run(); 99 job->Run();
100 } 100 }
101 101
102 void SetAccessTokenOnUIThread(const GURL& server_url, const string16& token) { 102 ChromeAccessTokenStore::~ChromeAccessTokenStore() {}
103
104 static void SetAccessTokenOnUIThread(const GURL& server_url,
105 const string16& token) {
103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
104 DictionaryPrefUpdate update(g_browser_process->local_state(), 107 DictionaryPrefUpdate update(g_browser_process->local_state(),
105 prefs::kGeolocationAccessToken); 108 prefs::kGeolocationAccessToken);
106 DictionaryValue* access_token_dictionary = update.Get(); 109 DictionaryValue* access_token_dictionary = update.Get();
107 access_token_dictionary->SetWithoutPathExpansion( 110 access_token_dictionary->SetWithoutPathExpansion(
108 server_url.spec(), Value::CreateStringValue(token)); 111 server_url.spec(), Value::CreateStringValue(token));
109 } 112 }
110 113
111 void ChromeAccessTokenStore::SaveAccessToken(const GURL& server_url, 114 void ChromeAccessTokenStore::SaveAccessToken(const GURL& server_url,
112 const string16& access_token) { 115 const string16& access_token) {
113 BrowserThread::PostTask( 116 BrowserThread::PostTask(
114 BrowserThread::UI, FROM_HERE, 117 BrowserThread::UI, FROM_HERE,
115 base::Bind(&SetAccessTokenOnUIThread, server_url, access_token)); 118 base::Bind(&SetAccessTokenOnUIThread, server_url, access_token));
116 } 119 }
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/chrome_access_token_store.h ('k') | chrome/browser/importer/external_process_importer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698