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

Side by Side Diff: chrome/browser/extensions/extension_history_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 #include "chrome/browser/extensions/extension_history_api.h" 5 #include "chrome/browser/extensions/extension_history_api.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/task.h" 11 #include "base/task.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/extensions/extension_event_router.h" 13 #include "chrome/browser/extensions/extension_event_router.h"
14 #include "chrome/browser/extensions/extension_history_api_constants.h" 14 #include "chrome/browser/extensions/extension_history_api_constants.h"
15 #include "chrome/browser/history/history.h" 15 #include "chrome/browser/history/history.h"
16 #include "chrome/browser/history/history_types.h" 16 #include "chrome/browser/history/history_types.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/chrome_notification_types.h"
18 #include "content/common/notification_service.h" 19 #include "content/common/notification_service.h"
19 #include "content/common/notification_type.h"
20 20
21 namespace keys = extension_history_api_constants; 21 namespace keys = extension_history_api_constants;
22 22
23 namespace { 23 namespace {
24 24
25 double MilliSecondsFromTime(const base::Time& time) { 25 double MilliSecondsFromTime(const base::Time& time) {
26 return 1000 * time.ToDoubleT(); 26 return 1000 * time.ToDoubleT();
27 } 27 }
28 28
29 void GetHistoryItemDictionary(const history::URLRow& row, 29 void GetHistoryItemDictionary(const history::URLRow& row,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } // namespace 65 } // namespace
66 66
67 ExtensionHistoryEventRouter::ExtensionHistoryEventRouter() {} 67 ExtensionHistoryEventRouter::ExtensionHistoryEventRouter() {}
68 68
69 ExtensionHistoryEventRouter::~ExtensionHistoryEventRouter() {} 69 ExtensionHistoryEventRouter::~ExtensionHistoryEventRouter() {}
70 70
71 void ExtensionHistoryEventRouter::ObserveProfile(Profile* profile) { 71 void ExtensionHistoryEventRouter::ObserveProfile(Profile* profile) {
72 NotificationSource source = Source<Profile>(profile); 72 NotificationSource source = Source<Profile>(profile);
73 CHECK(registrar_.IsEmpty()); 73 CHECK(registrar_.IsEmpty());
74 registrar_.Add(this, 74 registrar_.Add(this,
75 NotificationType::HISTORY_URL_VISITED, 75 chrome::NOTIFICATION_HISTORY_URL_VISITED,
76 source); 76 source);
77 registrar_.Add(this, 77 registrar_.Add(this,
78 NotificationType::HISTORY_URLS_DELETED, 78 chrome::NOTIFICATION_HISTORY_URLS_DELETED,
79 source); 79 source);
80 } 80 }
81 81
82 void ExtensionHistoryEventRouter::Observe(NotificationType type, 82 void ExtensionHistoryEventRouter::Observe(int type,
83 const NotificationSource& source, 83 const NotificationSource& source,
84 const NotificationDetails& details) { 84 const NotificationDetails& details) {
85 switch (type.value) { 85 switch (type) {
86 case NotificationType::HISTORY_URL_VISITED: 86 case chrome::NOTIFICATION_HISTORY_URL_VISITED:
87 HistoryUrlVisited( 87 HistoryUrlVisited(
88 Source<Profile>(source).ptr(), 88 Source<Profile>(source).ptr(),
89 Details<const history::URLVisitedDetails>(details).ptr()); 89 Details<const history::URLVisitedDetails>(details).ptr());
90 break; 90 break;
91 case NotificationType::HISTORY_URLS_DELETED: 91 case chrome::NOTIFICATION_HISTORY_URLS_DELETED:
92 HistoryUrlsRemoved( 92 HistoryUrlsRemoved(
93 Source<Profile>(source).ptr(), 93 Source<Profile>(source).ptr(),
94 Details<const history::URLsDeletedDetails>(details).ptr()); 94 Details<const history::URLsDeletedDetails>(details).ptr());
95 break; 95 break;
96 default: 96 default:
97 NOTREACHED(); 97 NOTREACHED();
98 } 98 }
99 } 99 }
100 100
101 void ExtensionHistoryEventRouter::HistoryUrlVisited( 101 void ExtensionHistoryEventRouter::HistoryUrlVisited(
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 base::Time::Now(), // To the current time. 364 base::Time::Now(), // To the current time.
365 &cancelable_consumer_, 365 &cancelable_consumer_,
366 NewCallback(this, &DeleteAllHistoryFunction::DeleteComplete)); 366 NewCallback(this, &DeleteAllHistoryFunction::DeleteComplete));
367 367
368 return true; 368 return true;
369 } 369 }
370 370
371 void DeleteAllHistoryFunction::DeleteComplete() { 371 void DeleteAllHistoryFunction::DeleteComplete() {
372 SendAsyncResponse(); 372 SendAsyncResponse();
373 } 373 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_history_api.h ('k') | chrome/browser/extensions/extension_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698