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 <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 cookie_store->SetCookieWithDetailsAsync( | 389 cookie_store->SetCookieWithDetailsAsync( |
390 url_, parsed_args_->details.name.get() ? *parsed_args_->details.name | 390 url_, parsed_args_->details.name.get() ? *parsed_args_->details.name |
391 : std::string(), | 391 : std::string(), |
392 parsed_args_->details.value.get() ? *parsed_args_->details.value | 392 parsed_args_->details.value.get() ? *parsed_args_->details.value |
393 : std::string(), | 393 : std::string(), |
394 parsed_args_->details.domain.get() ? *parsed_args_->details.domain | 394 parsed_args_->details.domain.get() ? *parsed_args_->details.domain |
395 : std::string(), | 395 : std::string(), |
396 parsed_args_->details.path.get() ? *parsed_args_->details.path | 396 parsed_args_->details.path.get() ? *parsed_args_->details.path |
397 : std::string(), | 397 : std::string(), |
398 base::Time(), | 398 base::Time(), expiration_time, base::Time(), |
399 expiration_time, | |
400 base::Time(), | |
401 parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get() | 399 parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get() |
402 : false, | 400 : false, |
403 parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only | 401 parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only |
404 : false, | 402 : false, |
405 // TODO(mkwst): If we decide to ship First-party-only cookies, we'll need | 403 // TODO(mkwst): If we decide to ship First-party-only cookies, we'll need |
406 // to extend the extension API to support them. For the moment, we'll set | 404 // to extend the extension API to support them. For the moment, we'll set |
407 // all cookies as non-First-party-only. | 405 // all cookies as non-First-party-only. |
408 false, are_experimental_cookie_features_enabled, | 406 net::CookieSameSite::DEFAULT_MODE, |
409 net::COOKIE_PRIORITY_DEFAULT, | 407 are_experimental_cookie_features_enabled, net::COOKIE_PRIORITY_DEFAULT, |
410 base::Bind(&CookiesSetFunction::PullCookie, this)); | 408 base::Bind(&CookiesSetFunction::PullCookie, this)); |
411 } | 409 } |
412 | 410 |
413 void CookiesSetFunction::PullCookie(bool set_cookie_result) { | 411 void CookiesSetFunction::PullCookie(bool set_cookie_result) { |
414 // Pull the newly set cookie. | 412 // Pull the newly set cookie. |
415 net::CookieStore* cookie_store = | 413 net::CookieStore* cookie_store = |
416 store_browser_context_->GetURLRequestContext()->cookie_store(); | 414 store_browser_context_->GetURLRequestContext()->cookie_store(); |
417 success_ = set_cookie_result; | 415 success_ = set_cookie_result; |
418 cookies_helpers::GetCookieListFromStore( | 416 cookies_helpers::GetCookieListFromStore( |
419 cookie_store, url_, | 417 cookie_store, url_, |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { | 579 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { |
582 return g_factory.Pointer(); | 580 return g_factory.Pointer(); |
583 } | 581 } |
584 | 582 |
585 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) { | 583 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) { |
586 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); | 584 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); |
587 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 585 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
588 } | 586 } |
589 | 587 |
590 } // namespace extensions | 588 } // namespace extensions |
OLD | NEW |