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

Side by Side Diff: chrome/browser/history/history_extension_api.h

Issue 10694085: Refactor extension event distribution to use Values instead of JSON strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing memory leak in a test. Created 8 years, 4 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) 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 #ifndef CHROME_BROWSER_HISTORY_HISTORY_EXTENSION_API_H_ 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_EXTENSION_API_H_
6 #define CHROME_BROWSER_HISTORY_HISTORY_EXTENSION_API_H_ 6 #define CHROME_BROWSER_HISTORY_HISTORY_EXTENSION_API_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/linked_ptr.h" 12 #include "base/memory/linked_ptr.h"
13 #include "chrome/browser/extensions/extension_function.h" 13 #include "chrome/browser/extensions/extension_function.h"
14 #include "chrome/browser/history/history.h" 14 #include "chrome/browser/history/history.h"
15 #include "chrome/browser/history/history_notifications.h" 15 #include "chrome/browser/history/history_notifications.h"
16 #include "chrome/common/extensions/api/history.h" 16 #include "chrome/common/extensions/api/history.h"
17 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
18 18
19 namespace base {
20 class ListValue;
21 }
22
19 typedef std::vector<linked_ptr< 23 typedef std::vector<linked_ptr<
20 extensions::api::history::HistoryItem> > HistoryItemList; 24 extensions::api::history::HistoryItem> > HistoryItemList;
21 typedef std::vector<linked_ptr< 25 typedef std::vector<linked_ptr<
22 extensions::api::history::VisitItem> > VisitItemList; 26 extensions::api::history::VisitItem> > VisitItemList;
23 27
24 // Observes History service and routes the notifications as events to the 28 // Observes History service and routes the notifications as events to the
25 // extension system. 29 // extension system.
26 class HistoryExtensionEventRouter : public content::NotificationObserver { 30 class HistoryExtensionEventRouter : public content::NotificationObserver {
27 public: 31 public:
28 explicit HistoryExtensionEventRouter(); 32 explicit HistoryExtensionEventRouter();
29 virtual ~HistoryExtensionEventRouter(); 33 virtual ~HistoryExtensionEventRouter();
30 34
31 void ObserveProfile(Profile* profile); 35 void ObserveProfile(Profile* profile);
32 36
33 private: 37 private:
34 // content::NotificationObserver::Observe. 38 // content::NotificationObserver::Observe.
35 virtual void Observe(int type, 39 virtual void Observe(int type,
36 const content::NotificationSource& source, 40 const content::NotificationSource& source,
37 const content::NotificationDetails& details) OVERRIDE; 41 const content::NotificationDetails& details) OVERRIDE;
38 42
39 void HistoryUrlVisited(Profile* profile, 43 void HistoryUrlVisited(Profile* profile,
40 const history::URLVisitedDetails* details); 44 const history::URLVisitedDetails* details);
41 45
42 void HistoryUrlsRemoved(Profile* profile, 46 void HistoryUrlsRemoved(Profile* profile,
43 const history::URLsDeletedDetails* details); 47 const history::URLsDeletedDetails* details);
44 48
45 void DispatchEvent(Profile* profile, 49 void DispatchEvent(Profile* profile,
46 const char* event_name, 50 const char* event_name,
47 const std::string& json_args); 51 scoped_ptr<base::ListValue> event_args);
48 52
49 // Used for tracking registrations to history service notifications. 53 // Used for tracking registrations to history service notifications.
50 content::NotificationRegistrar registrar_; 54 content::NotificationRegistrar registrar_;
51 55
52 DISALLOW_COPY_AND_ASSIGN(HistoryExtensionEventRouter); 56 DISALLOW_COPY_AND_ASSIGN(HistoryExtensionEventRouter);
53 }; 57 };
54 58
55 59
56 // Base class for history function APIs. 60 // Base class for history function APIs.
57 class HistoryFunction : public AsyncExtensionFunction { 61 class HistoryFunction : public AsyncExtensionFunction {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 virtual ~DeleteRangeHistoryFunction() {} 172 virtual ~DeleteRangeHistoryFunction() {}
169 173
170 // HistoryFunctionWithCallback: 174 // HistoryFunctionWithCallback:
171 virtual bool RunAsyncImpl() OVERRIDE; 175 virtual bool RunAsyncImpl() OVERRIDE;
172 176
173 // Callback for the history service to acknowledge deletion. 177 // Callback for the history service to acknowledge deletion.
174 void DeleteComplete(); 178 void DeleteComplete();
175 }; 179 };
176 180
177 #endif // CHROME_BROWSER_HISTORY_HISTORY_EXTENSION_API_H_ 181 #endif // CHROME_BROWSER_HISTORY_HISTORY_EXTENSION_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/window_event_router.cc ('k') | chrome/browser/history/history_extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698