| 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 // Implements the Chrome Extensions Cookies API. | 5 // Implements the Chrome Extensions Cookies API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_cookies_api.h" | 7 #include "chrome/browser/extensions/extension_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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // earliest creation time). | 227 // earliest creation time). |
| 228 if (it->Name() == name_) { | 228 if (it->Name() == name_) { |
| 229 result_.reset( | 229 result_.reset( |
| 230 extension_cookies_helpers::CreateCookieValue(*it, store_id_)); | 230 extension_cookies_helpers::CreateCookieValue(*it, store_id_)); |
| 231 break; | 231 break; |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 // The cookie doesn't exist; return null. | 235 // The cookie doesn't exist; return null. |
| 236 if (it == cookie_list.end()) | 236 if (it == cookie_list.end()) |
| 237 result_.reset(Value::CreateNullValue()); | 237 result_.reset(base::NullValue()); |
| 238 | 238 |
| 239 bool rv = BrowserThread::PostTask( | 239 bool rv = BrowserThread::PostTask( |
| 240 BrowserThread::UI, FROM_HERE, | 240 BrowserThread::UI, FROM_HERE, |
| 241 NewRunnableMethod(this, &GetCookieFunction::RespondOnUIThread)); | 241 NewRunnableMethod(this, &GetCookieFunction::RespondOnUIThread)); |
| 242 DCHECK(rv); | 242 DCHECK(rv); |
| 243 } | 243 } |
| 244 | 244 |
| 245 void GetCookieFunction::RespondOnUIThread() { | 245 void GetCookieFunction::RespondOnUIThread() { |
| 246 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 246 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 247 SendResponse(true); | 247 SendResponse(true); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 extension_cookies_helpers::CreateCookieStoreValue( | 532 extension_cookies_helpers::CreateCookieStoreValue( |
| 533 incognito_profile, incognito_tab_ids.release())); | 533 incognito_profile, incognito_tab_ids.release())); |
| 534 } | 534 } |
| 535 result_.reset(cookie_store_list); | 535 result_.reset(cookie_store_list); |
| 536 return true; | 536 return true; |
| 537 } | 537 } |
| 538 | 538 |
| 539 void GetAllCookieStoresFunction::Run() { | 539 void GetAllCookieStoresFunction::Run() { |
| 540 SendResponse(RunImpl()); | 540 SendResponse(RunImpl()); |
| 541 } | 541 } |
| OLD | NEW |