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

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

Issue 555283002: Create new class "CastTransport", which encapsulates the message read and write event loops. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback addressed. Created 6 years, 3 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 30 matching lines...) Expand all
41 class CastChannelAPI : public BrowserContextKeyedAPI, 41 class CastChannelAPI : public BrowserContextKeyedAPI,
42 public cast_channel::CastSocket::Delegate { 42 public cast_channel::CastSocket::Delegate {
43 public: 43 public:
44 explicit CastChannelAPI(content::BrowserContext* context); 44 explicit CastChannelAPI(content::BrowserContext* context);
45 45
46 static CastChannelAPI* Get(content::BrowserContext* context); 46 static CastChannelAPI* Get(content::BrowserContext* context);
47 47
48 // BrowserContextKeyedAPI implementation. 48 // BrowserContextKeyedAPI implementation.
49 static BrowserContextKeyedAPIFactory<CastChannelAPI>* GetFactoryInstance(); 49 static BrowserContextKeyedAPIFactory<CastChannelAPI>* GetFactoryInstance();
50 50
51 // Returns a new CastSocket that connects to |ip_endpoint| with authentication 51 // Returns a new CastSocket that connects to |ip_endpoint| with
52 // authentication
Wez 2014/09/25 02:09:15 nit: This can be un-wrapped now that CastSocket is
Kevin M 2014/09/25 17:53:04 Done.
52 // |channel_auth| and is to be owned by |extension_id|. 53 // |channel_auth| and is to be owned by |extension_id|.
53 scoped_ptr<cast_channel::CastSocket> CreateCastSocket( 54 scoped_ptr<cast_channel::CastSocket> CreateCastSocket(
54 const std::string& extension_id, 55 const std::string& extension_id,
55 const net::IPEndPoint& ip_endpoint, 56 const net::IPEndPoint& ip_endpoint,
56 cast_channel::ChannelAuthType channel_auth, 57 cast_channel::ChannelAuthType channel_auth,
57 const base::TimeDelta& timeout); 58 const base::TimeDelta& timeout);
58 59
59 // Returns a pointer to the Logger member variable. 60 // Returns a pointer to the Logger member variable.
60 // TODO(imcheng): Consider whether it is possible for this class to own the 61 // TODO(imcheng): Consider whether it is possible for this class to own the
61 // CastSockets and make this class the sole owner of Logger. Alternatively, 62 // CastSockets and make this class the sole owner of Logger.
63 // Alternatively,
Wez 2014/09/25 02:09:15 nit: And this!
Kevin M 2014/09/25 17:53:04 This function's still useful, the Open and GetLogs
62 // consider making Logger not ref-counted by passing a weak 64 // consider making Logger not ref-counted by passing a weak
63 // reference of Logger to the CastSockets instead. 65 // reference of Logger to the CastSockets instead.
64 scoped_refptr<cast_channel::Logger> GetLogger(); 66 scoped_refptr<cast_channel::Logger> GetLogger();
65 67
66 // Sets the CastSocket instance to be returned by CreateCastSocket for 68 // Sets the CastSocket instance to be returned by CreateCastSocket for
67 // testing. 69 // testing.
68 void SetSocketForTest(scoped_ptr<cast_channel::CastSocket> socket_for_test); 70 void SetSocketForTest(scoped_ptr<cast_channel::CastSocket> socket_for_test);
69 71
70 private: 72 private:
71 friend class BrowserContextKeyedAPIFactory<CastChannelAPI>; 73 friend class BrowserContextKeyedAPIFactory<CastChannelAPI>;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 void OnClose(int result); 240 void OnClose(int result);
239 241
240 CastChannelAPI* api_; 242 CastChannelAPI* api_;
241 243
242 DISALLOW_COPY_AND_ASSIGN(CastChannelGetLogsFunction); 244 DISALLOW_COPY_AND_ASSIGN(CastChannelGetLogsFunction);
243 }; 245 };
244 246
245 } // namespace extensions 247 } // namespace extensions
246 248
247 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ 249 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698