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

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

Issue 876973003: Implement the "first-party-only" cookie flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback. Created 5 years, 10 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 base::Time expiration_time; 378 base::Time expiration_time;
379 if (parsed_args_->details.expiration_date.get()) { 379 if (parsed_args_->details.expiration_date.get()) {
380 // Time::FromDoubleT converts double time 0 to empty Time object. So we need 380 // Time::FromDoubleT converts double time 0 to empty Time object. So we need
381 // to do special handling here. 381 // to do special handling here.
382 expiration_time = (*parsed_args_->details.expiration_date == 0) ? 382 expiration_time = (*parsed_args_->details.expiration_date == 0) ?
383 base::Time::UnixEpoch() : 383 base::Time::UnixEpoch() :
384 base::Time::FromDoubleT(*parsed_args_->details.expiration_date); 384 base::Time::FromDoubleT(*parsed_args_->details.expiration_date);
385 } 385 }
386 386
387 cookie_monster->SetCookieWithDetailsAsync( 387 cookie_monster->SetCookieWithDetailsAsync(
388 url_, 388 url_, parsed_args_->details.name.get() ? *parsed_args_->details.name
389 parsed_args_->details.name.get() ? *parsed_args_->details.name 389 : std::string(),
390 : std::string(),
391 parsed_args_->details.value.get() ? *parsed_args_->details.value 390 parsed_args_->details.value.get() ? *parsed_args_->details.value
392 : std::string(), 391 : std::string(),
393 parsed_args_->details.domain.get() ? *parsed_args_->details.domain 392 parsed_args_->details.domain.get() ? *parsed_args_->details.domain
394 : std::string(), 393 : std::string(),
395 parsed_args_->details.path.get() ? *parsed_args_->details.path 394 parsed_args_->details.path.get() ? *parsed_args_->details.path
396 : std::string(), 395 : std::string(),
397 expiration_time, 396 expiration_time,
398 parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get() 397 parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get()
399 : false, 398 : false,
400 parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only 399 parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only
401 : false, 400 : false,
401 false, // TODO(mkwst): FirstParty
Bernhard Bauer 2015/02/20 11:10:17 Can you elaborate on this TODO?
Mike West 2015/02/23 05:06:59 If we end up shipping this, we'll need to extend t
402 net::COOKIE_PRIORITY_DEFAULT, 402 net::COOKIE_PRIORITY_DEFAULT,
403 base::Bind(&CookiesSetFunction::PullCookie, this)); 403 base::Bind(&CookiesSetFunction::PullCookie, this));
404 } 404 }
405 405
406 void CookiesSetFunction::PullCookie(bool set_cookie_result) { 406 void CookiesSetFunction::PullCookie(bool set_cookie_result) {
407 // Pull the newly set cookie. 407 // Pull the newly set cookie.
408 net::CookieMonster* cookie_monster = 408 net::CookieMonster* cookie_monster =
409 store_browser_context_->GetURLRequestContext() 409 store_browser_context_->GetURLRequestContext()
410 ->cookie_store() 410 ->cookie_store()
411 ->GetCookieMonster(); 411 ->GetCookieMonster();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 return g_factory.Pointer(); 578 return g_factory.Pointer();
579 } 579 }
580 580
581 void CookiesAPI::OnListenerAdded( 581 void CookiesAPI::OnListenerAdded(
582 const extensions::EventListenerInfo& details) { 582 const extensions::EventListenerInfo& details) {
583 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); 583 cookies_event_router_.reset(new CookiesEventRouter(browser_context_));
584 EventRouter::Get(browser_context_)->UnregisterObserver(this); 584 EventRouter::Get(browser_context_)->UnregisterObserver(this);
585 } 585 }
586 586
587 } // namespace extensions 587 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/profile_auth_data_unittest.cc ('k') | chrome/browser/extensions/api/cookies/cookies_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698