Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: chrome/browser/extensions/extension_cookies_api.cc

Issue 6961027: Change event routers from singletons to being owned by the ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asargent and dmazzoni's comments Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
29 ExtensionCookiesEventRouter* ExtensionCookiesEventRouter::GetInstance() {
30 return Singleton<ExtensionCookiesEventRouter>::get();
31 }
32
33 void ExtensionCookiesEventRouter::Init() { 28 void ExtensionCookiesEventRouter::Init() {
34 if (registrar_.IsEmpty()) { 29 if (registrar_.IsEmpty()) {
35 registrar_.Add(this, 30 registrar_.Add(this,
36 NotificationType::COOKIE_CHANGED, 31 NotificationType::COOKIE_CHANGED,
37 NotificationService::AllSources()); 32 NotificationService::AllSources());
38 } 33 }
39 } 34 }
40 35
41 void ExtensionCookiesEventRouter::Observe(NotificationType type, 36 void ExtensionCookiesEventRouter::Observe(NotificationType type,
42 const NotificationSource& source, 37 const NotificationSource& source,
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 extension_cookies_helpers::CreateCookieStoreValue( 500 extension_cookies_helpers::CreateCookieStoreValue(
506 incognito_profile, incognito_tab_ids.release())); 501 incognito_profile, incognito_tab_ids.release()));
507 } 502 }
508 result_.reset(cookie_store_list); 503 result_.reset(cookie_store_list);
509 return true; 504 return true;
510 } 505 }
511 506
512 void GetAllCookieStoresFunction::Run() { 507 void GetAllCookieStoresFunction::Run() {
513 SendResponse(RunImpl()); 508 SendResponse(RunImpl());
514 } 509 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698