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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 | 111 |
112 ChromeAccessTokenStore::~ChromeAccessTokenStore() {} | 112 ChromeAccessTokenStore::~ChromeAccessTokenStore() {} |
113 | 113 |
114 static void SetAccessTokenOnUIThread(const GURL& server_url, | 114 static void SetAccessTokenOnUIThread(const GURL& server_url, |
115 const base::string16& token) { | 115 const base::string16& token) { |
116 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 116 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
117 DictionaryPrefUpdate update(g_browser_process->local_state(), | 117 DictionaryPrefUpdate update(g_browser_process->local_state(), |
118 prefs::kGeolocationAccessToken); | 118 prefs::kGeolocationAccessToken); |
119 base::DictionaryValue* access_token_dictionary = update.Get(); | 119 base::DictionaryValue* access_token_dictionary = update.Get(); |
120 access_token_dictionary->SetWithoutPathExpansion(server_url.spec(), | 120 access_token_dictionary->SetStringWithoutPathExpansion(server_url.spec(), |
121 new base::Value(token)); | 121 token); |
122 } | 122 } |
123 | 123 |
124 void ChromeAccessTokenStore::SaveAccessToken( | 124 void ChromeAccessTokenStore::SaveAccessToken( |
125 const GURL& server_url, | 125 const GURL& server_url, |
126 const base::string16& access_token) { | 126 const base::string16& access_token) { |
127 BrowserThread::PostTask( | 127 BrowserThread::PostTask( |
128 BrowserThread::UI, FROM_HERE, | 128 BrowserThread::UI, FROM_HERE, |
129 base::BindOnce(&SetAccessTokenOnUIThread, server_url, access_token)); | 129 base::BindOnce(&SetAccessTokenOnUIThread, server_url, access_token)); |
130 } | 130 } |
OLD | NEW |