| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/extensions/extension_cookies_api_constants.h" | 12 #include "chrome/browser/extensions/extension_cookies_api_constants.h" |
| 13 #include "chrome/browser/extensions/extension_cookies_helpers.h" | 13 #include "chrome/browser/extensions/extension_cookies_helpers.h" |
| 14 #include "chrome/browser/extensions/extension_event_router.h" | 14 #include "chrome/browser/extensions/extension_event_router.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
| 17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 18 #include "chrome/common/extensions/extension_error_utils.h" | 18 #include "chrome/common/extensions/extension_error_utils.h" |
| 19 #include "content/browser/browser_thread.h" | 19 #include "content/browser/browser_thread.h" |
| 20 #include "content/common/notification_service.h" | 20 #include "content/common/notification_service.h" |
| 21 #include "content/common/notification_type.h" | 21 #include "content/common/notification_type.h" |
| 22 #include "net/base/cookie_monster.h" | 22 #include "net/base/cookie_monster.h" |
| 23 #include "net/url_request/url_request_context.h" | 23 #include "net/url_request/url_request_context.h" |
| 24 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
| 25 | 25 |
| 26 namespace keys = extension_cookies_api_constants; | 26 namespace keys = extension_cookies_api_constants; |
| 27 | 27 |
| 28 // static | 28 ExtensionCookiesEventRouter::ExtensionCookiesEventRouter() {} |
| 29 ExtensionCookiesEventRouter* ExtensionCookiesEventRouter::GetInstance() { | 29 |
| 30 return Singleton<ExtensionCookiesEventRouter>::get(); | 30 ExtensionCookiesEventRouter::~ExtensionCookiesEventRouter() {} |
| 31 } | |
| 32 | 31 |
| 33 void ExtensionCookiesEventRouter::Init() { | 32 void ExtensionCookiesEventRouter::Init() { |
| 34 if (registrar_.IsEmpty()) { | 33 if (registrar_.IsEmpty()) { |
| 35 registrar_.Add(this, | 34 registrar_.Add(this, |
| 36 NotificationType::COOKIE_CHANGED, | 35 NotificationType::COOKIE_CHANGED, |
| 37 NotificationService::AllSources()); | 36 NotificationService::AllSources()); |
| 38 } | 37 } |
| 39 } | 38 } |
| 40 | 39 |
| 41 void ExtensionCookiesEventRouter::Observe(NotificationType type, | 40 void ExtensionCookiesEventRouter::Observe(NotificationType type, |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 extension_cookies_helpers::CreateCookieStoreValue( | 504 extension_cookies_helpers::CreateCookieStoreValue( |
| 506 incognito_profile, incognito_tab_ids.release())); | 505 incognito_profile, incognito_tab_ids.release())); |
| 507 } | 506 } |
| 508 result_.reset(cookie_store_list); | 507 result_.reset(cookie_store_list); |
| 509 return true; | 508 return true; |
| 510 } | 509 } |
| 511 | 510 |
| 512 void GetAllCookieStoresFunction::Run() { | 511 void GetAllCookieStoresFunction::Run() { |
| 513 SendResponse(RunImpl()); | 512 SendResponse(RunImpl()); |
| 514 } | 513 } |
| OLD | NEW |