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 // Implements the Chrome Extensions Cookies API. | 5 // Implements the Chrome Extensions Cookies API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/cookies/cookies_api.h" | 7 #include "chrome/browser/extensions/api/cookies/cookies_api.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 283 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
284 net::CookieStore* cookie_store = | 284 net::CookieStore* cookie_store = |
285 store_context_->GetURLRequestContext()->cookie_store(); | 285 store_context_->GetURLRequestContext()->cookie_store(); |
286 cookies_helpers::GetCookieListFromStore( | 286 cookies_helpers::GetCookieListFromStore( |
287 cookie_store, url_, | 287 cookie_store, url_, |
288 base::Bind(&GetAllCookiesFunction::GetAllCookiesCallback, this)); | 288 base::Bind(&GetAllCookiesFunction::GetAllCookiesCallback, this)); |
289 } | 289 } |
290 | 290 |
291 void GetAllCookiesFunction::GetAllCookiesCallback( | 291 void GetAllCookiesFunction::GetAllCookiesCallback( |
292 const net::CookieList& cookie_list) { | 292 const net::CookieList& cookie_list) { |
293 const Extension* extension = GetExtension(); | 293 const extensions::Extension* extension = GetExtension(); |
294 if (extension) { | 294 if (extension) { |
295 ListValue* matching_list = new ListValue(); | 295 ListValue* matching_list = new ListValue(); |
296 cookies_helpers::AppendMatchingCookiesToList( | 296 cookies_helpers::AppendMatchingCookiesToList( |
297 cookie_list, store_id_, url_, details_, | 297 cookie_list, store_id_, url_, details_, |
298 GetExtension(), matching_list); | 298 GetExtension(), matching_list); |
299 result_.reset(matching_list); | 299 result_.reset(matching_list); |
300 } | 300 } |
301 bool rv = BrowserThread::PostTask( | 301 bool rv = BrowserThread::PostTask( |
302 BrowserThread::UI, FROM_HERE, | 302 BrowserThread::UI, FROM_HERE, |
303 base::Bind(&GetAllCookiesFunction::RespondOnUIThread, this)); | 303 base::Bind(&GetAllCookiesFunction::RespondOnUIThread, this)); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 } | 538 } |
539 result_.reset(cookie_store_list); | 539 result_.reset(cookie_store_list); |
540 return true; | 540 return true; |
541 } | 541 } |
542 | 542 |
543 void GetAllCookieStoresFunction::Run() { | 543 void GetAllCookieStoresFunction::Run() { |
544 SendResponse(RunImpl()); | 544 SendResponse(RunImpl()); |
545 } | 545 } |
546 | 546 |
547 } // namespace extensions | 547 } // namespace extensions |
OLD | NEW |