Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 namespace GetAll = extensions::api::cookies::GetAll; | 40 namespace GetAll = extensions::api::cookies::GetAll; |
| 41 namespace GetAllCookieStores = extensions::api::cookies::GetAllCookieStores; | 41 namespace GetAllCookieStores = extensions::api::cookies::GetAllCookieStores; |
| 42 namespace Remove = extensions::api::cookies::Remove; | 42 namespace Remove = extensions::api::cookies::Remove; |
| 43 namespace Set = extensions::api::cookies::Set; | 43 namespace Set = extensions::api::cookies::Set; |
| 44 | 44 |
| 45 namespace extensions { | 45 namespace extensions { |
| 46 namespace keys = cookies_api_constants; | 46 namespace keys = cookies_api_constants; |
| 47 | 47 |
| 48 ExtensionCookiesEventRouter::ExtensionCookiesEventRouter(Profile* profile) | 48 ExtensionCookiesEventRouter::ExtensionCookiesEventRouter(Profile* profile) |
| 49 : profile_(profile) { | 49 : profile_(profile) { |
| 50 } | |
| 51 | |
| 52 ExtensionCookiesEventRouter::~ExtensionCookiesEventRouter() { | |
| 53 } | |
| 54 | |
| 55 void ExtensionCookiesEventRouter::Init() { | |
| 56 CHECK(registrar_.IsEmpty()); | 50 CHECK(registrar_.IsEmpty()); |
| 57 registrar_.Add(this, | 51 registrar_.Add(this, |
| 58 chrome::NOTIFICATION_COOKIE_CHANGED, | 52 chrome::NOTIFICATION_COOKIE_CHANGED, |
| 59 content::NotificationService::AllBrowserContextsAndSources()); | 53 content::NotificationService::AllBrowserContextsAndSources()); |
| 60 } | 54 } |
| 61 | 55 |
| 56 ExtensionCookiesEventRouter::~ExtensionCookiesEventRouter() { | |
| 57 } | |
| 62 void ExtensionCookiesEventRouter::Observe( | 58 void ExtensionCookiesEventRouter::Observe( |
|
Aaron Boodman
2012/11/04 18:43:22
insert blank line
Yoyo Zhou
2012/11/05 20:08:23
Done.
| |
| 63 int type, | 59 int type, |
| 64 const content::NotificationSource& source, | 60 const content::NotificationSource& source, |
| 65 const content::NotificationDetails& details) { | 61 const content::NotificationDetails& details) { |
| 66 Profile* profile = content::Source<Profile>(source).ptr(); | 62 Profile* profile = content::Source<Profile>(source).ptr(); |
| 67 if (!profile_->IsSameProfile(profile)) | 63 if (!profile_->IsSameProfile(profile)) |
| 68 return; | 64 return; |
| 69 | 65 |
| 70 switch (type) { | 66 switch (type) { |
| 71 case chrome::NOTIFICATION_COOKIE_CHANGED: | 67 case chrome::NOTIFICATION_COOKIE_CHANGED: |
| 72 CookieChanged( | 68 CookieChanged( |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 537 } | 533 } |
| 538 results_ = GetAllCookieStores::Results::Create(cookie_stores); | 534 results_ = GetAllCookieStores::Results::Create(cookie_stores); |
| 539 return true; | 535 return true; |
| 540 } | 536 } |
| 541 | 537 |
| 542 void GetAllCookieStoresFunction::Run() { | 538 void GetAllCookieStoresFunction::Run() { |
| 543 SendResponse(RunImpl()); | 539 SendResponse(RunImpl()); |
| 544 } | 540 } |
| 545 | 541 |
| 546 } // namespace extensions | 542 } // namespace extensions |
| OLD | NEW |