OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_CURRENTLY_ON(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(server_url.spec(), |
122 server_url.spec(), new base::StringValue(token)); | 122 new base::Value(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 } |
OLD | NEW |