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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/chrome_notification_types.h"
17 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/extensions/extension_error_utils.h" 19 #include "chrome/common/extensions/extension_error_utils.h"
19 #include "content/browser/browser_thread.h" 20 #include "content/browser/browser_thread.h"
20 #include "content/common/notification_service.h" 21 #include "content/common/notification_service.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 ExtensionCookiesEventRouter::ExtensionCookiesEventRouter(Profile* profile) 28 ExtensionCookiesEventRouter::ExtensionCookiesEventRouter(Profile* profile)
29 : profile_(profile) {} 29 : profile_(profile) {}
30 30
31 ExtensionCookiesEventRouter::~ExtensionCookiesEventRouter() {} 31 ExtensionCookiesEventRouter::~ExtensionCookiesEventRouter() {}
32 32
33 void ExtensionCookiesEventRouter::Init() { 33 void ExtensionCookiesEventRouter::Init() {
34 CHECK(registrar_.IsEmpty()); 34 CHECK(registrar_.IsEmpty());
35 registrar_.Add(this, 35 registrar_.Add(this,
36 NotificationType::COOKIE_CHANGED, 36 chrome::NOTIFICATION_COOKIE_CHANGED,
37 NotificationService::AllSources()); 37 NotificationService::AllSources());
38 } 38 }
39 39
40 void ExtensionCookiesEventRouter::Observe(NotificationType type, 40 void ExtensionCookiesEventRouter::Observe(int type,
41 const NotificationSource& source, 41 const NotificationSource& source,
42 const NotificationDetails& details) { 42 const NotificationDetails& details) {
43 Profile* profile = Source<Profile>(source).ptr(); 43 Profile* profile = Source<Profile>(source).ptr();
44 if (!profile_->IsSameProfile(profile)) { 44 if (!profile_->IsSameProfile(profile)) {
45 return; 45 return;
46 } 46 }
47 switch (type.value) { 47 switch (type) {
48 case NotificationType::COOKIE_CHANGED: 48 case chrome::NOTIFICATION_COOKIE_CHANGED:
49 CookieChanged( 49 CookieChanged(
50 profile, 50 profile,
51 Details<ChromeCookieDetails>(details).ptr()); 51 Details<ChromeCookieDetails>(details).ptr());
52 break; 52 break;
53 53
54 default: 54 default:
55 NOTREACHED(); 55 NOTREACHED();
56 } 56 }
57 } 57 }
58 58
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 extension_cookies_helpers::CreateCookieStoreValue( 509 extension_cookies_helpers::CreateCookieStoreValue(
510 incognito_profile, incognito_tab_ids.release())); 510 incognito_profile, incognito_tab_ids.release()));
511 } 511 }
512 result_.reset(cookie_store_list); 512 result_.reset(cookie_store_list);
513 return true; 513 return true;
514 } 514 }
515 515
516 void GetAllCookieStoresFunction::Run() { 516 void GetAllCookieStoresFunction::Run() {
517 SendResponse(RunImpl()); 517 SendResponse(RunImpl());
518 } 518 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_cookies_api.h ('k') | chrome/browser/extensions/extension_debugger_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698