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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
24 #include "chrome/browser/ui/browser_iterator.h" | 24 #include "chrome/browser/ui/browser_iterator.h" |
25 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
26 #include "chrome/common/extensions/api/cookies.h" | 26 #include "chrome/common/extensions/api/cookies.h" |
27 #include "chrome/common/extensions/extension.h" | 27 #include "chrome/common/extensions/extension.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
30 #include "extensions/common/error_utils.h" | 30 #include "extensions/common/error_utils.h" |
31 #include "net/cookies/canonical_cookie.h" | 31 #include "net/cookies/canonical_cookie.h" |
| 32 #include "net/cookies/cookie_constants.h" |
32 #include "net/cookies/cookie_monster.h" | 33 #include "net/cookies/cookie_monster.h" |
33 #include "net/url_request/url_request_context.h" | 34 #include "net/url_request/url_request_context.h" |
34 #include "net/url_request/url_request_context_getter.h" | 35 #include "net/url_request/url_request_context_getter.h" |
35 | 36 |
36 using content::BrowserThread; | 37 using content::BrowserThread; |
37 using extensions::api::cookies::Cookie; | 38 using extensions::api::cookies::Cookie; |
38 using extensions::api::cookies::CookieStore; | 39 using extensions::api::cookies::CookieStore; |
39 | 40 |
40 namespace Get = extensions::api::cookies::Get; | 41 namespace Get = extensions::api::cookies::Get; |
41 namespace GetAll = extensions::api::cookies::GetAll; | 42 namespace GetAll = extensions::api::cookies::GetAll; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 : std::string(), | 384 : std::string(), |
384 parsed_args_->details.domain.get() ? *parsed_args_->details.domain | 385 parsed_args_->details.domain.get() ? *parsed_args_->details.domain |
385 : std::string(), | 386 : std::string(), |
386 parsed_args_->details.path.get() ? *parsed_args_->details.path | 387 parsed_args_->details.path.get() ? *parsed_args_->details.path |
387 : std::string(), | 388 : std::string(), |
388 expiration_time, | 389 expiration_time, |
389 parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get() | 390 parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get() |
390 : false, | 391 : false, |
391 parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only | 392 parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only |
392 : false, | 393 : false, |
| 394 net::PRIORITY_DEFAULT, |
393 base::Bind(&CookiesSetFunction::PullCookie, this)); | 395 base::Bind(&CookiesSetFunction::PullCookie, this)); |
394 } | 396 } |
395 | 397 |
396 void CookiesSetFunction::PullCookie(bool set_cookie_result) { | 398 void CookiesSetFunction::PullCookie(bool set_cookie_result) { |
397 // Pull the newly set cookie. | 399 // Pull the newly set cookie. |
398 net::CookieMonster* cookie_monster = | 400 net::CookieMonster* cookie_monster = |
399 store_context_->GetURLRequestContext()->cookie_store()-> | 401 store_context_->GetURLRequestContext()->cookie_store()-> |
400 GetCookieMonster(); | 402 GetCookieMonster(); |
401 success_ = set_cookie_result; | 403 success_ = set_cookie_result; |
402 cookies_helpers::GetCookieListFromStore( | 404 cookies_helpers::GetCookieListFromStore( |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 return &g_factory.Get(); | 573 return &g_factory.Get(); |
572 } | 574 } |
573 | 575 |
574 void CookiesAPI::OnListenerAdded( | 576 void CookiesAPI::OnListenerAdded( |
575 const extensions::EventListenerInfo& details) { | 577 const extensions::EventListenerInfo& details) { |
576 cookies_event_router_.reset(new CookiesEventRouter(profile_)); | 578 cookies_event_router_.reset(new CookiesEventRouter(profile_)); |
577 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 579 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
578 } | 580 } |
579 | 581 |
580 } // namespace extensions | 582 } // namespace extensions |
OLD | NEW |