OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension_cookies_api.h" | 7 #include "chrome/browser/extensions/extension_cookies_api.h" |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 EXTENSION_FUNCTION_VALIDATE(details->Get(keys::kExpirationDateKey, | 305 EXTENSION_FUNCTION_VALIDATE(details->Get(keys::kExpirationDateKey, |
306 &expiration_date_value)); | 306 &expiration_date_value)); |
307 double expiration_date; | 307 double expiration_date; |
308 if (expiration_date_value->IsType(Value::TYPE_INTEGER)) { | 308 if (expiration_date_value->IsType(Value::TYPE_INTEGER)) { |
309 int expiration_date_int; | 309 int expiration_date_int; |
310 EXTENSION_FUNCTION_VALIDATE( | 310 EXTENSION_FUNCTION_VALIDATE( |
311 expiration_date_value->GetAsInteger(&expiration_date_int)); | 311 expiration_date_value->GetAsInteger(&expiration_date_int)); |
312 expiration_date = static_cast<double>(expiration_date_int); | 312 expiration_date = static_cast<double>(expiration_date_int); |
313 } else { | 313 } else { |
314 EXTENSION_FUNCTION_VALIDATE( | 314 EXTENSION_FUNCTION_VALIDATE( |
315 expiration_date_value->GetAsReal(&expiration_date)); | 315 expiration_date_value->GetAsDouble(&expiration_date)); |
316 } | 316 } |
317 // Time::FromDoubleT converts double time 0 to empty Time object. So we need | 317 // Time::FromDoubleT converts double time 0 to empty Time object. So we need |
318 // to do special handling here. | 318 // to do special handling here. |
319 expiration_time_ = (expiration_date == 0) ? | 319 expiration_time_ = (expiration_date == 0) ? |
320 base::Time::UnixEpoch() : base::Time::FromDoubleT(expiration_date); | 320 base::Time::UnixEpoch() : base::Time::FromDoubleT(expiration_date); |
321 } | 321 } |
322 | 322 |
323 URLRequestContextGetter* store_context = NULL; | 323 URLRequestContextGetter* store_context = NULL; |
324 if (!ParseStoreContext(details, &store_context, NULL)) | 324 if (!ParseStoreContext(details, &store_context, NULL)) |
325 return false; | 325 return false; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 extension_cookies_helpers::CreateCookieStoreValue( | 459 extension_cookies_helpers::CreateCookieStoreValue( |
460 incognito_profile, incognito_tab_ids.release())); | 460 incognito_profile, incognito_tab_ids.release())); |
461 } | 461 } |
462 result_.reset(cookie_store_list); | 462 result_.reset(cookie_store_list); |
463 return true; | 463 return true; |
464 } | 464 } |
465 | 465 |
466 void GetAllCookieStoresFunction::Run() { | 466 void GetAllCookieStoresFunction::Run() { |
467 SendResponse(RunImpl()); | 467 SendResponse(RunImpl()); |
468 } | 468 } |
OLD | NEW |