| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 event->event_url = cookie_domain; | 198 event->event_url = cookie_domain; |
| 199 router->BroadcastEvent(event.Pass()); | 199 router->BroadcastEvent(event.Pass()); |
| 200 } | 200 } |
| 201 | 201 |
| 202 CookiesGetFunction::CookiesGetFunction() { | 202 CookiesGetFunction::CookiesGetFunction() { |
| 203 } | 203 } |
| 204 | 204 |
| 205 CookiesGetFunction::~CookiesGetFunction() { | 205 CookiesGetFunction::~CookiesGetFunction() { |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool CookiesGetFunction::RunImpl() { | 208 bool CookiesGetFunction::RunAsync() { |
| 209 parsed_args_ = Get::Params::Create(*args_); | 209 parsed_args_ = Get::Params::Create(*args_); |
| 210 EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); | 210 EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); |
| 211 | 211 |
| 212 // Read/validate input parameters. | 212 // Read/validate input parameters. |
| 213 if (!ParseUrl(this, parsed_args_->details.url, &url_, true)) | 213 if (!ParseUrl(this, parsed_args_->details.url, &url_, true)) |
| 214 return false; | 214 return false; |
| 215 | 215 |
| 216 std::string store_id = | 216 std::string store_id = |
| 217 parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id | 217 parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id |
| 218 : std::string(); | 218 : std::string(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 271 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 272 SendResponse(true); | 272 SendResponse(true); |
| 273 } | 273 } |
| 274 | 274 |
| 275 CookiesGetAllFunction::CookiesGetAllFunction() { | 275 CookiesGetAllFunction::CookiesGetAllFunction() { |
| 276 } | 276 } |
| 277 | 277 |
| 278 CookiesGetAllFunction::~CookiesGetAllFunction() { | 278 CookiesGetAllFunction::~CookiesGetAllFunction() { |
| 279 } | 279 } |
| 280 | 280 |
| 281 bool CookiesGetAllFunction::RunImpl() { | 281 bool CookiesGetAllFunction::RunAsync() { |
| 282 parsed_args_ = GetAll::Params::Create(*args_); | 282 parsed_args_ = GetAll::Params::Create(*args_); |
| 283 EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); | 283 EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); |
| 284 | 284 |
| 285 if (parsed_args_->details.url.get() && | 285 if (parsed_args_->details.url.get() && |
| 286 !ParseUrl(this, *parsed_args_->details.url, &url_, false)) { | 286 !ParseUrl(this, *parsed_args_->details.url, &url_, false)) { |
| 287 return false; | 287 return false; |
| 288 } | 288 } |
| 289 | 289 |
| 290 std::string store_id = | 290 std::string store_id = |
| 291 parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id | 291 parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 336 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 337 SendResponse(true); | 337 SendResponse(true); |
| 338 } | 338 } |
| 339 | 339 |
| 340 CookiesSetFunction::CookiesSetFunction() : success_(false) { | 340 CookiesSetFunction::CookiesSetFunction() : success_(false) { |
| 341 } | 341 } |
| 342 | 342 |
| 343 CookiesSetFunction::~CookiesSetFunction() { | 343 CookiesSetFunction::~CookiesSetFunction() { |
| 344 } | 344 } |
| 345 | 345 |
| 346 bool CookiesSetFunction::RunImpl() { | 346 bool CookiesSetFunction::RunAsync() { |
| 347 parsed_args_ = Set::Params::Create(*args_); | 347 parsed_args_ = Set::Params::Create(*args_); |
| 348 EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); | 348 EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); |
| 349 | 349 |
| 350 // Read/validate input parameters. | 350 // Read/validate input parameters. |
| 351 if (!ParseUrl(this, parsed_args_->details.url, &url_, true)) | 351 if (!ParseUrl(this, parsed_args_->details.url, &url_, true)) |
| 352 return false; | 352 return false; |
| 353 | 353 |
| 354 std::string store_id = | 354 std::string store_id = |
| 355 parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id | 355 parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id |
| 356 : std::string(); | 356 : std::string(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 451 } |
| 452 SendResponse(success_); | 452 SendResponse(success_); |
| 453 } | 453 } |
| 454 | 454 |
| 455 CookiesRemoveFunction::CookiesRemoveFunction() { | 455 CookiesRemoveFunction::CookiesRemoveFunction() { |
| 456 } | 456 } |
| 457 | 457 |
| 458 CookiesRemoveFunction::~CookiesRemoveFunction() { | 458 CookiesRemoveFunction::~CookiesRemoveFunction() { |
| 459 } | 459 } |
| 460 | 460 |
| 461 bool CookiesRemoveFunction::RunImpl() { | 461 bool CookiesRemoveFunction::RunAsync() { |
| 462 parsed_args_ = Remove::Params::Create(*args_); | 462 parsed_args_ = Remove::Params::Create(*args_); |
| 463 EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); | 463 EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); |
| 464 | 464 |
| 465 // Read/validate input parameters. | 465 // Read/validate input parameters. |
| 466 if (!ParseUrl(this, parsed_args_->details.url, &url_, true)) | 466 if (!ParseUrl(this, parsed_args_->details.url, &url_, true)) |
| 467 return false; | 467 return false; |
| 468 | 468 |
| 469 std::string store_id = | 469 std::string store_id = |
| 470 parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id | 470 parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id |
| 471 : std::string(); | 471 : std::string(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 return g_factory.Pointer(); | 580 return g_factory.Pointer(); |
| 581 } | 581 } |
| 582 | 582 |
| 583 void CookiesAPI::OnListenerAdded( | 583 void CookiesAPI::OnListenerAdded( |
| 584 const extensions::EventListenerInfo& details) { | 584 const extensions::EventListenerInfo& details) { |
| 585 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); | 585 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); |
| 586 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 586 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 587 } | 587 } |
| 588 | 588 |
| 589 } // namespace extensions | 589 } // namespace extensions |
| OLD | NEW |