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

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

Issue 10071032: RefCounted types should not have public destructors, chrome/browser/ part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 #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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 // Used for tracking registrations to history service notifications. 42 // Used for tracking registrations to history service notifications.
43 content::NotificationRegistrar registrar_; 43 content::NotificationRegistrar registrar_;
44 44
45 DISALLOW_COPY_AND_ASSIGN(HistoryExtensionEventRouter); 45 DISALLOW_COPY_AND_ASSIGN(HistoryExtensionEventRouter);
46 }; 46 };
47 47
48 48
49 // Base class for history function APIs. 49 // Base class for history function APIs.
50 class HistoryFunction : public AsyncExtensionFunction { 50 class HistoryFunction : public AsyncExtensionFunction {
51 public: 51 protected:
sky 2012/04/13 15:50:52 Did you intend to make Run/RunIMpl protected?
Ryan Sleevi 2012/04/13 19:00:25 Run() no, RunImpl() yes. Similar things can be sa
52 virtual ~HistoryFunction() {}
52 virtual void Run() OVERRIDE; 53 virtual void Run() OVERRIDE;
53 virtual bool RunImpl() = 0; 54 virtual bool RunImpl() = 0;
54 55
55 bool GetUrlFromValue(base::Value* value, GURL* url); 56 bool GetUrlFromValue(base::Value* value, GURL* url);
56 bool GetTimeFromValue(base::Value* value, base::Time* time); 57 bool GetTimeFromValue(base::Value* value, base::Time* time);
57 }; 58 };
58 59
59 // Base class for history funciton APIs which require async interaction with 60 // Base class for history funciton APIs which require async interaction with
60 // chrome services and the extension thread. 61 // chrome services and the extension thread.
61 class HistoryFunctionWithCallback : public HistoryFunction { 62 class HistoryFunctionWithCallback : public HistoryFunction {
62 public: 63 public:
63 HistoryFunctionWithCallback(); 64 HistoryFunctionWithCallback();
64 virtual ~HistoryFunctionWithCallback();
65 65
66 // Return true if the async call was completed, false otherwise. 66 // Return true if the async call was completed, false otherwise.
67 virtual bool RunAsyncImpl() = 0; 67 virtual bool RunAsyncImpl() = 0;
68 68
69 // Call this method to report the results of the async method to the caller. 69 // Call this method to report the results of the async method to the caller.
70 // This method calls Release(). 70 // This method calls Release().
71 virtual void SendAsyncResponse(); 71 virtual void SendAsyncResponse();
72 72
73 protected:
74 virtual ~HistoryFunctionWithCallback();
75
73 // Override HistoryFunction::RunImpl. 76 // Override HistoryFunction::RunImpl.
74 virtual bool RunImpl() OVERRIDE; 77 virtual bool RunImpl() OVERRIDE;
75 78
76 protected:
77 // The consumer for the HistoryService callbacks. 79 // The consumer for the HistoryService callbacks.
78 CancelableRequestConsumer cancelable_consumer_; 80 CancelableRequestConsumer cancelable_consumer_;
79 81
80 private: 82 private:
81 // The actual call to SendResponse. This is required since the semantics for 83 // The actual call to SendResponse. This is required since the semantics for
82 // CancelableRequestConsumerT require it to be accessed after the call. 84 // CancelableRequestConsumerT require it to be accessed after the call.
83 void SendResponseToCallback(); 85 void SendResponseToCallback();
84 }; 86 };
85 87
86 class GetVisitsHistoryFunction : public HistoryFunctionWithCallback { 88 class GetVisitsHistoryFunction : public HistoryFunctionWithCallback {
87 public: 89 public:
88 // Override HistoryFunction. 90 // Override HistoryFunction.
89 virtual bool RunAsyncImpl() OVERRIDE; 91 virtual bool RunAsyncImpl() OVERRIDE;
90 DECLARE_EXTENSION_FUNCTION_NAME("history.getVisits"); 92 DECLARE_EXTENSION_FUNCTION_NAME("history.getVisits");
91 93
92 // Callback for the history function to provide results. 94 // Callback for the history function to provide results.
93 void QueryComplete(HistoryService::Handle request_service, 95 void QueryComplete(HistoryService::Handle request_service,
94 bool success, 96 bool success,
95 const history::URLRow* url_row, 97 const history::URLRow* url_row,
96 history::VisitVector* visits); 98 history::VisitVector* visits);
99
100 protected:
101 virtual ~GetVisitsHistoryFunction() {}
97 }; 102 };
98 103
99 class SearchHistoryFunction : public HistoryFunctionWithCallback { 104 class SearchHistoryFunction : public HistoryFunctionWithCallback {
100 public: 105 public:
101 virtual bool RunAsyncImpl() OVERRIDE; 106 virtual bool RunAsyncImpl() OVERRIDE;
102 DECLARE_EXTENSION_FUNCTION_NAME("history.search"); 107 DECLARE_EXTENSION_FUNCTION_NAME("history.search");
103 108
104 // Callback for the history function to provide results. 109 // Callback for the history function to provide results.
105 void SearchComplete(HistoryService::Handle request_handle, 110 void SearchComplete(HistoryService::Handle request_handle,
106 history::QueryResults* results); 111 history::QueryResults* results);
112
113 protected:
114 virtual ~SearchHistoryFunction() {}
107 }; 115 };
108 116
109 class AddUrlHistoryFunction : public HistoryFunction { 117 class AddUrlHistoryFunction : public HistoryFunction {
110 public: 118 public:
111 virtual bool RunImpl() OVERRIDE; 119 virtual bool RunImpl() OVERRIDE;
112 DECLARE_EXTENSION_FUNCTION_NAME("history.addUrl"); 120 DECLARE_EXTENSION_FUNCTION_NAME("history.addUrl");
121
122 protected:
123 virtual ~AddUrlHistoryFunction() {}
113 }; 124 };
114 125
115 class DeleteAllHistoryFunction : public HistoryFunctionWithCallback { 126 class DeleteAllHistoryFunction : public HistoryFunctionWithCallback {
116 public: 127 public:
117 virtual bool RunAsyncImpl() OVERRIDE; 128 virtual bool RunAsyncImpl() OVERRIDE;
118 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteAll"); 129 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteAll");
119 130
120 // Callback for the history service to acknowledge deletion. 131 // Callback for the history service to acknowledge deletion.
121 void DeleteComplete(); 132 void DeleteComplete();
133
134 protected:
135 virtual ~DeleteAllHistoryFunction() {}
122 }; 136 };
123 137
124 138
125 class DeleteUrlHistoryFunction : public HistoryFunction { 139 class DeleteUrlHistoryFunction : public HistoryFunction {
126 public: 140 public:
127 virtual bool RunImpl() OVERRIDE; 141 virtual bool RunImpl() OVERRIDE;
128 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteUrl"); 142 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteUrl");
143
144 protected:
145 virtual ~DeleteUrlHistoryFunction() {}
129 }; 146 };
130 147
131 class DeleteRangeHistoryFunction : public HistoryFunctionWithCallback { 148 class DeleteRangeHistoryFunction : public HistoryFunctionWithCallback {
132 public: 149 public:
133 virtual bool RunAsyncImpl() OVERRIDE; 150 virtual bool RunAsyncImpl() OVERRIDE;
134 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteRange"); 151 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteRange");
135 152
136 // Callback for the history service to acknowledge deletion. 153 // Callback for the history service to acknowledge deletion.
137 void DeleteComplete(); 154 void DeleteComplete();
155
156 protected:
157 virtual ~DeleteRangeHistoryFunction() {}
138 }; 158 };
139 159
140 #endif // CHROME_BROWSER_HISTORY_HISTORY_EXTENSION_API_H_ 160 #endif // CHROME_BROWSER_HISTORY_HISTORY_EXTENSION_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698