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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 void SetCookieFunction::RespondOnUIThread() { | 422 void SetCookieFunction::RespondOnUIThread() { |
423 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 423 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
424 if (!success_) { | 424 if (!success_) { |
425 error_ = ExtensionErrorUtils::FormatErrorMessage( | 425 error_ = ExtensionErrorUtils::FormatErrorMessage( |
426 keys::kCookieSetFailedError, name_); | 426 keys::kCookieSetFailedError, name_); |
427 } | 427 } |
428 SendResponse(success_); | 428 SendResponse(success_); |
429 } | 429 } |
430 | 430 |
431 RemoveCookieFunction::RemoveCookieFunction() : success_(false) { | 431 RemoveCookieFunction::RemoveCookieFunction() { |
432 } | 432 } |
433 | 433 |
434 RemoveCookieFunction::~RemoveCookieFunction() { | 434 RemoveCookieFunction::~RemoveCookieFunction() { |
435 } | 435 } |
436 | 436 |
437 bool RemoveCookieFunction::RunImpl() { | 437 bool RemoveCookieFunction::RunImpl() { |
438 // Return false if the arguments are malformed. | 438 // Return false if the arguments are malformed. |
439 DictionaryValue* details; | 439 DictionaryValue* details; |
440 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details)); | 440 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details)); |
441 DCHECK(details); | 441 DCHECK(details); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 } | 537 } |
538 SetResult(cookie_store_list); | 538 SetResult(cookie_store_list); |
539 return true; | 539 return true; |
540 } | 540 } |
541 | 541 |
542 void GetAllCookieStoresFunction::Run() { | 542 void GetAllCookieStoresFunction::Run() { |
543 SendResponse(RunImpl()); | 543 SendResponse(RunImpl()); |
544 } | 544 } |
545 | 545 |
546 } // namespace extensions | 546 } // namespace extensions |
OLD | NEW |