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

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

Issue 1097083004: [chrome/browser/e*-i*] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 base::Bind(&TokenLoadingJob::PerformWorkOnUIThread, this), 52 base::Bind(&TokenLoadingJob::PerformWorkOnUIThread, this),
53 base::Bind(&TokenLoadingJob::RespondOnOriginatingThread, this)); 53 base::Bind(&TokenLoadingJob::RespondOnOriginatingThread, this));
54 } 54 }
55 55
56 private: 56 private:
57 friend class base::RefCountedThreadSafe<TokenLoadingJob>; 57 friend class base::RefCountedThreadSafe<TokenLoadingJob>;
58 58
59 ~TokenLoadingJob() {} 59 ~TokenLoadingJob() {}
60 60
61 void PerformWorkOnUIThread() { 61 void PerformWorkOnUIThread() {
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 62 DCHECK_CURRENTLY_ON(BrowserThread::UI);
63 DictionaryPrefUpdate update(g_browser_process->local_state(), 63 DictionaryPrefUpdate update(g_browser_process->local_state(),
64 prefs::kGeolocationAccessToken); 64 prefs::kGeolocationAccessToken);
65 base::DictionaryValue* token_dictionary = update.Get(); 65 base::DictionaryValue* token_dictionary = update.Get();
66 66
67 std::vector<std::string> providers_to_remove; 67 std::vector<std::string> providers_to_remove;
68 // The dictionary value could be NULL if the pref has never been set. 68 // The dictionary value could be NULL if the pref has never been set.
69 if (token_dictionary != NULL) { 69 if (token_dictionary != NULL) {
70 for (base::DictionaryValue::Iterator it(*token_dictionary); !it.IsAtEnd(); 70 for (base::DictionaryValue::Iterator it(*token_dictionary); !it.IsAtEnd();
71 it.Advance()) { 71 it.Advance()) {
72 GURL url(it.key()); 72 GURL url(it.key());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 base::string16& token) { 116 const base::string16& token) {
117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 117 DCHECK_CURRENTLY_ON(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 base::DictionaryValue* access_token_dictionary = update.Get(); 120 base::DictionaryValue* access_token_dictionary = update.Get();
121 access_token_dictionary->SetWithoutPathExpansion( 121 access_token_dictionary->SetWithoutPathExpansion(
122 server_url.spec(), new base::StringValue(token)); 122 server_url.spec(), new base::StringValue(token));
123 } 123 }
124 124
125 void ChromeAccessTokenStore::SaveAccessToken( 125 void ChromeAccessTokenStore::SaveAccessToken(
126 const GURL& server_url, 126 const GURL& server_url,
127 const base::string16& access_token) { 127 const base::string16& access_token) {
128 BrowserThread::PostTask( 128 BrowserThread::PostTask(
129 BrowserThread::UI, FROM_HERE, 129 BrowserThread::UI, FROM_HERE,
130 base::Bind(&SetAccessTokenOnUIThread, server_url, access_token)); 130 base::Bind(&SetAccessTokenOnUIThread, server_url, access_token));
131 } 131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698