| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 prefs::kGeolocationAccessToken); | 43 prefs::kGeolocationAccessToken); |
| 44 | 44 |
| 45 AccessTokenStore::AccessTokenSet access_token_set; | 45 AccessTokenStore::AccessTokenSet access_token_set; |
| 46 // The dictionary value could be NULL if the pref has never been set. | 46 // The dictionary value could be NULL if the pref has never been set. |
| 47 if (token_dictionary != NULL) { | 47 if (token_dictionary != NULL) { |
| 48 for (DictionaryValue::key_iterator it = token_dictionary->begin_keys(); | 48 for (DictionaryValue::key_iterator it = token_dictionary->begin_keys(); |
| 49 it != token_dictionary->end_keys(); ++it) { | 49 it != token_dictionary->end_keys(); ++it) { |
| 50 GURL url(*it); | 50 GURL url(*it); |
| 51 if (!url.is_valid()) | 51 if (!url.is_valid()) |
| 52 continue; | 52 continue; |
| 53 token_dictionary->GetStringAsUTF16WithoutPathExpansion( | 53 token_dictionary->GetStringWithoutPathExpansion(*it, |
| 54 *it, &access_token_set[url]); | 54 &access_token_set[url]); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 request->ForwardResultAsync(MakeTuple(access_token_set)); | 57 request->ForwardResultAsync(MakeTuple(access_token_set)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void ChromePrefsAccessTokenStore::DoLoadAccessTokens( | 60 void ChromePrefsAccessTokenStore::DoLoadAccessTokens( |
| 61 scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > request) { | 61 scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > request) { |
| 62 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, NewRunnableMethod( | 62 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, NewRunnableMethod( |
| 63 this, &ChromePrefsAccessTokenStore::LoadDictionaryStoreInUIThread, | 63 this, &ChromePrefsAccessTokenStore::LoadDictionaryStoreInUIThread, |
| 64 request)); | 64 request)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |