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

Side by Side Diff: extensions/browser/api/cast_channel/cast_channel_api.h

Issue 664933004: Standardize usage of virtual/override/final in extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void SetSocketForTest(scoped_ptr<cast_channel::CastSocket> socket_for_test); 61 void SetSocketForTest(scoped_ptr<cast_channel::CastSocket> socket_for_test);
62 62
63 // Returns a test CastSocket instance, if it is defined. 63 // Returns a test CastSocket instance, if it is defined.
64 // Otherwise returns a scoped_ptr with a NULL ptr value. 64 // Otherwise returns a scoped_ptr with a NULL ptr value.
65 scoped_ptr<cast_channel::CastSocket> GetSocketForTest(); 65 scoped_ptr<cast_channel::CastSocket> GetSocketForTest();
66 66
67 private: 67 private:
68 friend class BrowserContextKeyedAPIFactory<CastChannelAPI>; 68 friend class BrowserContextKeyedAPIFactory<CastChannelAPI>;
69 friend class ::CastChannelAPITest; 69 friend class ::CastChannelAPITest;
70 70
71 virtual ~CastChannelAPI(); 71 ~CastChannelAPI() override;
72 72
73 // CastSocket::Delegate. Called on IO thread. 73 // CastSocket::Delegate. Called on IO thread.
74 virtual void OnError(const cast_channel::CastSocket* socket, 74 void OnError(const cast_channel::CastSocket* socket,
75 cast_channel::ChannelError error_state, 75 cast_channel::ChannelError error_state,
76 const cast_channel::LastErrors& last_errors) override; 76 const cast_channel::LastErrors& last_errors) override;
77 virtual void OnMessage(const cast_channel::CastSocket* socket, 77 void OnMessage(const cast_channel::CastSocket* socket,
78 const cast_channel::MessageInfo& message) override; 78 const cast_channel::MessageInfo& message) override;
79 79
80 // BrowserContextKeyedAPI implementation. 80 // BrowserContextKeyedAPI implementation.
81 static const char* service_name() { return "CastChannelAPI"; } 81 static const char* service_name() { return "CastChannelAPI"; }
82 82
83 content::BrowserContext* const browser_context_; 83 content::BrowserContext* const browser_context_;
84 scoped_refptr<cast_channel::Logger> logger_; 84 scoped_refptr<cast_channel::Logger> logger_;
85 scoped_ptr<cast_channel::CastSocket> socket_for_test_; 85 scoped_ptr<cast_channel::CastSocket> socket_for_test_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(CastChannelAPI); 87 DISALLOW_COPY_AND_ASSIGN(CastChannelAPI);
88 }; 88 };
89 89
90 class CastChannelAsyncApiFunction : public AsyncApiFunction { 90 class CastChannelAsyncApiFunction : public AsyncApiFunction {
91 public: 91 public:
92 CastChannelAsyncApiFunction(); 92 CastChannelAsyncApiFunction();
93 93
94 protected: 94 protected:
95 virtual ~CastChannelAsyncApiFunction(); 95 ~CastChannelAsyncApiFunction() override;
96 96
97 // AsyncApiFunction: 97 // AsyncApiFunction:
98 virtual bool PrePrepare() override; 98 bool PrePrepare() override;
99 virtual bool Respond() override; 99 bool Respond() override;
100 100
101 // Returns the socket corresponding to |channel_id| if one exists. Otherwise, 101 // Returns the socket corresponding to |channel_id| if one exists. Otherwise,
102 // sets the function result with CHANNEL_ERROR_INVALID_CHANNEL_ID, completes 102 // sets the function result with CHANNEL_ERROR_INVALID_CHANNEL_ID, completes
103 // the function, and returns null. 103 // the function, and returns null.
104 cast_channel::CastSocket* GetSocketOrCompleteWithError(int channel_id); 104 cast_channel::CastSocket* GetSocketOrCompleteWithError(int channel_id);
105 105
106 // Adds |socket| to |manager_| and returns the new channel_id. |manager_| 106 // Adds |socket| to |manager_| and returns the new channel_id. |manager_|
107 // assumes ownership of |socket|. 107 // assumes ownership of |socket|.
108 int AddSocket(cast_channel::CastSocket* socket); 108 int AddSocket(cast_channel::CastSocket* socket);
109 109
(...skipping 22 matching lines...) Expand all
132 132
133 // The result of the function. 133 // The result of the function.
134 cast_channel::ChannelError error_; 134 cast_channel::ChannelError error_;
135 }; 135 };
136 136
137 class CastChannelOpenFunction : public CastChannelAsyncApiFunction { 137 class CastChannelOpenFunction : public CastChannelAsyncApiFunction {
138 public: 138 public:
139 CastChannelOpenFunction(); 139 CastChannelOpenFunction();
140 140
141 protected: 141 protected:
142 virtual ~CastChannelOpenFunction(); 142 ~CastChannelOpenFunction() override;
143 143
144 // AsyncApiFunction: 144 // AsyncApiFunction:
145 virtual bool PrePrepare() override; 145 bool PrePrepare() override;
146 virtual bool Prepare() override; 146 bool Prepare() override;
147 virtual void AsyncWorkStart() override; 147 void AsyncWorkStart() override;
148 148
149 private: 149 private:
150 DECLARE_EXTENSION_FUNCTION("cast.channel.open", CAST_CHANNEL_OPEN) 150 DECLARE_EXTENSION_FUNCTION("cast.channel.open", CAST_CHANNEL_OPEN)
151 151
152 // Parses the cast:// or casts:// |url|, fills |connect_info| with the 152 // Parses the cast:// or casts:// |url|, fills |connect_info| with the
153 // corresponding details, and returns true. Returns false if |url| is not a 153 // corresponding details, and returns true. Returns false if |url| is not a
154 // valid Cast URL. 154 // valid Cast URL.
155 static bool ParseChannelUrl(const GURL& url, 155 static bool ParseChannelUrl(const GURL& url,
156 cast_channel::ConnectInfo* connect_info); 156 cast_channel::ConnectInfo* connect_info);
157 157
(...skipping 15 matching lines...) Expand all
173 FRIEND_TEST_ALL_PREFIXES(CastChannelOpenFunctionTest, TestParseChannelUrl); 173 FRIEND_TEST_ALL_PREFIXES(CastChannelOpenFunctionTest, TestParseChannelUrl);
174 FRIEND_TEST_ALL_PREFIXES(CastChannelOpenFunctionTest, TestParseConnectInfo); 174 FRIEND_TEST_ALL_PREFIXES(CastChannelOpenFunctionTest, TestParseConnectInfo);
175 DISALLOW_COPY_AND_ASSIGN(CastChannelOpenFunction); 175 DISALLOW_COPY_AND_ASSIGN(CastChannelOpenFunction);
176 }; 176 };
177 177
178 class CastChannelSendFunction : public CastChannelAsyncApiFunction { 178 class CastChannelSendFunction : public CastChannelAsyncApiFunction {
179 public: 179 public:
180 CastChannelSendFunction(); 180 CastChannelSendFunction();
181 181
182 protected: 182 protected:
183 virtual ~CastChannelSendFunction(); 183 ~CastChannelSendFunction() override;
184 184
185 // AsyncApiFunction: 185 // AsyncApiFunction:
186 virtual bool Prepare() override; 186 bool Prepare() override;
187 virtual void AsyncWorkStart() override; 187 void AsyncWorkStart() override;
188 188
189 private: 189 private:
190 DECLARE_EXTENSION_FUNCTION("cast.channel.send", CAST_CHANNEL_SEND) 190 DECLARE_EXTENSION_FUNCTION("cast.channel.send", CAST_CHANNEL_SEND)
191 191
192 void OnSend(int result); 192 void OnSend(int result);
193 193
194 scoped_ptr<cast_channel::Send::Params> params_; 194 scoped_ptr<cast_channel::Send::Params> params_;
195 195
196 DISALLOW_COPY_AND_ASSIGN(CastChannelSendFunction); 196 DISALLOW_COPY_AND_ASSIGN(CastChannelSendFunction);
197 }; 197 };
198 198
199 class CastChannelCloseFunction : public CastChannelAsyncApiFunction { 199 class CastChannelCloseFunction : public CastChannelAsyncApiFunction {
200 public: 200 public:
201 CastChannelCloseFunction(); 201 CastChannelCloseFunction();
202 202
203 protected: 203 protected:
204 virtual ~CastChannelCloseFunction(); 204 ~CastChannelCloseFunction() override;
205 205
206 // AsyncApiFunction: 206 // AsyncApiFunction:
207 virtual bool Prepare() override; 207 bool Prepare() override;
208 virtual void AsyncWorkStart() override; 208 void AsyncWorkStart() override;
209 209
210 private: 210 private:
211 DECLARE_EXTENSION_FUNCTION("cast.channel.close", CAST_CHANNEL_CLOSE) 211 DECLARE_EXTENSION_FUNCTION("cast.channel.close", CAST_CHANNEL_CLOSE)
212 212
213 void OnClose(int result); 213 void OnClose(int result);
214 214
215 scoped_ptr<cast_channel::Close::Params> params_; 215 scoped_ptr<cast_channel::Close::Params> params_;
216 216
217 DISALLOW_COPY_AND_ASSIGN(CastChannelCloseFunction); 217 DISALLOW_COPY_AND_ASSIGN(CastChannelCloseFunction);
218 }; 218 };
219 219
220 class CastChannelGetLogsFunction : public CastChannelAsyncApiFunction { 220 class CastChannelGetLogsFunction : public CastChannelAsyncApiFunction {
221 public: 221 public:
222 CastChannelGetLogsFunction(); 222 CastChannelGetLogsFunction();
223 223
224 protected: 224 protected:
225 virtual ~CastChannelGetLogsFunction(); 225 ~CastChannelGetLogsFunction() override;
226 226
227 // AsyncApiFunction: 227 // AsyncApiFunction:
228 virtual bool PrePrepare() override; 228 bool PrePrepare() override;
229 virtual bool Prepare() override; 229 bool Prepare() override;
230 virtual void AsyncWorkStart() override; 230 void AsyncWorkStart() override;
231 231
232 private: 232 private:
233 DECLARE_EXTENSION_FUNCTION("cast.channel.getLogs", CAST_CHANNEL_GETLOGS) 233 DECLARE_EXTENSION_FUNCTION("cast.channel.getLogs", CAST_CHANNEL_GETLOGS)
234 234
235 void OnClose(int result); 235 void OnClose(int result);
236 236
237 CastChannelAPI* api_; 237 CastChannelAPI* api_;
238 238
239 DISALLOW_COPY_AND_ASSIGN(CastChannelGetLogsFunction); 239 DISALLOW_COPY_AND_ASSIGN(CastChannelGetLogsFunction);
240 }; 240 };
241 241
242 } // namespace extensions 242 } // namespace extensions
243 243
244 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ 244 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/capture_web_contents_function.h ('k') | extensions/browser/api/cast_channel/cast_channel_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698