| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/access_token_store.h" | 5 #include "chrome/browser/geolocation/access_token_store.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 request)); | 64 request)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void SetAccessTokenOnUIThread(const GURL& server_url, const string16& token) { | 67 void SetAccessTokenOnUIThread(const GURL& server_url, const string16& token) { |
| 68 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 68 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 69 DictionaryValue* access_token_dictionary = | 69 DictionaryValue* access_token_dictionary = |
| 70 g_browser_process->local_state()->GetMutableDictionary( | 70 g_browser_process->local_state()->GetMutableDictionary( |
| 71 prefs::kGeolocationAccessToken); | 71 prefs::kGeolocationAccessToken); |
| 72 access_token_dictionary->SetWithoutPathExpansion( | 72 access_token_dictionary->SetWithoutPathExpansion( |
| 73 UTF8ToWide(server_url.spec()), | 73 UTF8ToWide(server_url.spec()), |
| 74 Value::CreateStringValueFromUTF16(token)); | 74 Value::CreateStringValue(token)); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void ChromePrefsAccessTokenStore::SaveAccessToken( | 77 void ChromePrefsAccessTokenStore::SaveAccessToken( |
| 78 const GURL& server_url, const string16& access_token) { | 78 const GURL& server_url, const string16& access_token) { |
| 79 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, NewRunnableFunction( | 79 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, NewRunnableFunction( |
| 80 &SetAccessTokenOnUIThread, server_url, access_token)); | 80 &SetAccessTokenOnUIThread, server_url, access_token)); |
| 81 } | 81 } |
| 82 } // namespace | 82 } // namespace |
| 83 | 83 |
| 84 AccessTokenStore::AccessTokenStore() { | 84 AccessTokenStore::AccessTokenStore() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 100 DCHECK(request->handle()); | 100 DCHECK(request->handle()); |
| 101 | 101 |
| 102 DoLoadAccessTokens(request); | 102 DoLoadAccessTokens(request); |
| 103 return request->handle(); | 103 return request->handle(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Creates a new access token store backed by the global chome prefs. | 106 // Creates a new access token store backed by the global chome prefs. |
| 107 AccessTokenStore* NewChromePrefsAccessTokenStore() { | 107 AccessTokenStore* NewChromePrefsAccessTokenStore() { |
| 108 return new ChromePrefsAccessTokenStore; | 108 return new ChromePrefsAccessTokenStore; |
| 109 } | 109 } |
| OLD | NEW |