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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 ExtensionCookiesEventRouter::ExtensionCookiesEventRouter(Profile* profile) | 29 ExtensionCookiesEventRouter::ExtensionCookiesEventRouter(Profile* profile) |
30 : profile_(profile) {} | 30 : profile_(profile) {} |
31 | 31 |
32 ExtensionCookiesEventRouter::~ExtensionCookiesEventRouter() {} | 32 ExtensionCookiesEventRouter::~ExtensionCookiesEventRouter() {} |
33 | 33 |
34 void ExtensionCookiesEventRouter::Init() { | 34 void ExtensionCookiesEventRouter::Init() { |
35 CHECK(registrar_.IsEmpty()); | 35 CHECK(registrar_.IsEmpty()); |
36 registrar_.Add(this, | 36 registrar_.Add(this, |
37 chrome::NOTIFICATION_COOKIE_CHANGED, | 37 chrome::NOTIFICATION_COOKIE_CHANGED, |
38 NotificationService::AllSources()); | 38 NotificationService::AllBrowserContextsAndSources()); |
39 } | 39 } |
40 | 40 |
41 void ExtensionCookiesEventRouter::Observe(int type, | 41 void ExtensionCookiesEventRouter::Observe(int type, |
42 const NotificationSource& source, | 42 const NotificationSource& source, |
43 const NotificationDetails& details) { | 43 const NotificationDetails& details) { |
44 Profile* profile = Source<Profile>(source).ptr(); | 44 Profile* profile = Source<Profile>(source).ptr(); |
45 if (!profile_->IsSameProfile(profile)) { | 45 if (!profile_->IsSameProfile(profile)) { |
46 return; | 46 return; |
47 } | 47 } |
48 switch (type) { | 48 switch (type) { |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 extension_cookies_helpers::CreateCookieStoreValue( | 532 extension_cookies_helpers::CreateCookieStoreValue( |
533 incognito_profile, incognito_tab_ids.release())); | 533 incognito_profile, incognito_tab_ids.release())); |
534 } | 534 } |
535 result_.reset(cookie_store_list); | 535 result_.reset(cookie_store_list); |
536 return true; | 536 return true; |
537 } | 537 } |
538 | 538 |
539 void GetAllCookieStoresFunction::Run() { | 539 void GetAllCookieStoresFunction::Run() { |
540 SendResponse(RunImpl()); | 540 SendResponse(RunImpl()); |
541 } | 541 } |
OLD | NEW |