Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: chrome/browser/extensions/api/cookies/cookies_api.cc

Issue 1409243003: Revert of Implement $Secure- cookie prefix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 base::Time expiration_time; 375 base::Time expiration_time;
376 if (parsed_args_->details.expiration_date.get()) { 376 if (parsed_args_->details.expiration_date.get()) {
377 // Time::FromDoubleT converts double time 0 to empty Time object. So we need 377 // Time::FromDoubleT converts double time 0 to empty Time object. So we need
378 // to do special handling here. 378 // to do special handling here.
379 expiration_time = (*parsed_args_->details.expiration_date == 0) ? 379 expiration_time = (*parsed_args_->details.expiration_date == 0) ?
380 base::Time::UnixEpoch() : 380 base::Time::UnixEpoch() :
381 base::Time::FromDoubleT(*parsed_args_->details.expiration_date); 381 base::Time::FromDoubleT(*parsed_args_->details.expiration_date);
382 } 382 }
383 383
384 cookie_monster->SetCookieWithDetailsAsync( 384 cookie_monster->SetCookieWithDetailsAsync(
385 url_, parsed_args_->details.name.get() ? *parsed_args_->details.name 385 url_,
386 : std::string(), 386 parsed_args_->details.name.get() ? *parsed_args_->details.name
387 : std::string(),
387 parsed_args_->details.value.get() ? *parsed_args_->details.value 388 parsed_args_->details.value.get() ? *parsed_args_->details.value
388 : std::string(), 389 : std::string(),
389 parsed_args_->details.domain.get() ? *parsed_args_->details.domain 390 parsed_args_->details.domain.get() ? *parsed_args_->details.domain
390 : std::string(), 391 : std::string(),
391 parsed_args_->details.path.get() ? *parsed_args_->details.path 392 parsed_args_->details.path.get() ? *parsed_args_->details.path
392 : std::string(), 393 : std::string(),
393 expiration_time, 394 expiration_time,
394 parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get() 395 parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get()
395 : false, 396 : false,
396 parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only 397 parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only
397 : false, 398 : false,
398 // TODO(mkwst): If we decide to ship First-party-only cookies, we'll need 399 // TODO(mkwst): If we decide to ship First-party-only cookies, we'll need
399 // to extend the extension API to support them. For the moment, we'll set 400 // to extend the extension API to support them. For the moment, we'll set
400 // all cookies as non-First-party-only. 401 // all cookies as non-First-party-only.
401 false, store_browser_context_->GetURLRequestContext() 402 false,
402 ->network_delegate()
403 ->AreExperimentalCookieFeaturesEnabled(),
404 net::COOKIE_PRIORITY_DEFAULT, 403 net::COOKIE_PRIORITY_DEFAULT,
405 base::Bind(&CookiesSetFunction::PullCookie, this)); 404 base::Bind(&CookiesSetFunction::PullCookie, this));
406 } 405 }
407 406
408 void CookiesSetFunction::PullCookie(bool set_cookie_result) { 407 void CookiesSetFunction::PullCookie(bool set_cookie_result) {
409 // Pull the newly set cookie. 408 // Pull the newly set cookie.
410 net::CookieMonster* cookie_monster = 409 net::CookieMonster* cookie_monster =
411 store_browser_context_->GetURLRequestContext() 410 store_browser_context_->GetURLRequestContext()
412 ->cookie_store() 411 ->cookie_store()
413 ->GetCookieMonster(); 412 ->GetCookieMonster();
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { 578 BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() {
580 return g_factory.Pointer(); 579 return g_factory.Pointer();
581 } 580 }
582 581
583 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) { 582 void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) {
584 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); 583 cookies_event_router_.reset(new CookiesEventRouter(browser_context_));
585 EventRouter::Get(browser_context_)->UnregisterObserver(this); 584 EventRouter::Get(browser_context_)->UnregisterObserver(this);
586 } 585 }
587 586
588 } // namespace extensions 587 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/android/cookies/cookies_fetcher.cc ('k') | content/browser/frame_host/render_frame_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698