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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 incognito_profile, incognito_tab_ids.release()).release())); | 553 incognito_profile, incognito_tab_ids.release()).release())); |
554 } | 554 } |
555 results_ = GetAllCookieStores::Results::Create(cookie_stores); | 555 results_ = GetAllCookieStores::Results::Create(cookie_stores); |
556 return true; | 556 return true; |
557 } | 557 } |
558 | 558 |
559 void CookiesGetAllCookieStoresFunction::Run() { | 559 void CookiesGetAllCookieStoresFunction::Run() { |
560 SendResponse(RunImpl()); | 560 SendResponse(RunImpl()); |
561 } | 561 } |
562 | 562 |
563 CookiesAPI::CookiesAPI(Profile* profile) | 563 CookiesAPI::CookiesAPI(content::BrowserContext* context) |
564 : profile_(profile) { | 564 : browser_context_(context) { |
565 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( | 565 ExtensionSystem::Get(browser_context_)->event_router()->RegisterObserver( |
566 this, cookies::OnChanged::kEventName); | 566 this, cookies::OnChanged::kEventName); |
567 } | 567 } |
568 | 568 |
569 CookiesAPI::~CookiesAPI() { | 569 CookiesAPI::~CookiesAPI() { |
570 } | 570 } |
571 | 571 |
572 void CookiesAPI::Shutdown() { | 572 void CookiesAPI::Shutdown() { |
573 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 573 ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver( |
| 574 this); |
574 } | 575 } |
575 | 576 |
576 static base::LazyInstance<ProfileKeyedAPIFactory<CookiesAPI> > | 577 static base::LazyInstance<ProfileKeyedAPIFactory<CookiesAPI> > |
577 g_factory = LAZY_INSTANCE_INITIALIZER; | 578 g_factory = LAZY_INSTANCE_INITIALIZER; |
578 | 579 |
579 // static | 580 // static |
580 ProfileKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { | 581 ProfileKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() { |
581 return g_factory.Pointer(); | 582 return g_factory.Pointer(); |
582 } | 583 } |
583 | 584 |
584 void CookiesAPI::OnListenerAdded( | 585 void CookiesAPI::OnListenerAdded( |
585 const extensions::EventListenerInfo& details) { | 586 const extensions::EventListenerInfo& details) { |
586 cookies_event_router_.reset(new CookiesEventRouter(profile_)); | 587 cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); |
587 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 588 ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver( |
| 589 this); |
588 } | 590 } |
589 | 591 |
590 } // namespace extensions | 592 } // namespace extensions |
OLD | NEW |