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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 361 |
362 base::Time expiration_time; | 362 base::Time expiration_time; |
363 if (parsed_args_->details.expiration_date.get()) { | 363 if (parsed_args_->details.expiration_date.get()) { |
364 // Time::FromDoubleT converts double time 0 to empty Time object. So we need | 364 // Time::FromDoubleT converts double time 0 to empty Time object. So we need |
365 // to do special handling here. | 365 // to do special handling here. |
366 expiration_time = (*parsed_args_->details.expiration_date == 0) ? | 366 expiration_time = (*parsed_args_->details.expiration_date == 0) ? |
367 base::Time::UnixEpoch() : | 367 base::Time::UnixEpoch() : |
368 base::Time::FromDoubleT(*parsed_args_->details.expiration_date); | 368 base::Time::FromDoubleT(*parsed_args_->details.expiration_date); |
369 } | 369 } |
370 | 370 |
371 if (parsed_args_->details.name.get()) | |
372 LOG(INFO) << "Cookie name: " << *parsed_args_->details.name; | |
373 | |
374 cookie_monster->SetCookieWithDetailsAsync( | 371 cookie_monster->SetCookieWithDetailsAsync( |
375 url_, | 372 url_, |
376 parsed_args_->details.name.get() ? *parsed_args_->details.name : "", | 373 parsed_args_->details.name.get() ? *parsed_args_->details.name : "", |
377 parsed_args_->details.value.get() ? *parsed_args_->details.value : "", | 374 parsed_args_->details.value.get() ? *parsed_args_->details.value : "", |
378 parsed_args_->details.domain.get() ? *parsed_args_->details.domain : "", | 375 parsed_args_->details.domain.get() ? *parsed_args_->details.domain : "", |
379 parsed_args_->details.path.get() ? *parsed_args_->details.path : "", | 376 parsed_args_->details.path.get() ? *parsed_args_->details.path : "", |
380 expiration_time, | 377 expiration_time, |
381 parsed_args_->details.secure.get() ? | 378 parsed_args_->details.secure.get() ? |
382 *parsed_args_->details.secure.get() : | 379 *parsed_args_->details.secure.get() : |
383 false, | 380 false, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 533 } |
537 results_ = GetAllCookieStores::Results::Create(cookie_stores); | 534 results_ = GetAllCookieStores::Results::Create(cookie_stores); |
538 return true; | 535 return true; |
539 } | 536 } |
540 | 537 |
541 void GetAllCookieStoresFunction::Run() { | 538 void GetAllCookieStoresFunction::Run() { |
542 SendResponse(RunImpl()); | 539 SendResponse(RunImpl()); |
543 } | 540 } |
544 | 541 |
545 } // namespace extensions | 542 } // namespace extensions |
OLD | NEW |