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