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

Unified Diff: extensions/browser/api/cast_channel/cast_channel_api.h

Issue 2891023002: [cast_channel] Make CastSocket not inherit from ApiResource (Closed)
Patch Set: resolve code review comments from Derek Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/cast_channel/cast_channel_api.h
diff --git a/extensions/browser/api/cast_channel/cast_channel_api.h b/extensions/browser/api/cast_channel/cast_channel_api.h
index c257599da0abc997db1b5bd771a95346cc2bdf88..d396a5de4376a29d898d6d6dbbc2c64c4c6b4bc8 100644
--- a/extensions/browser/api/cast_channel/cast_channel_api.h
+++ b/extensions/browser/api/cast_channel/cast_channel_api.h
@@ -12,7 +12,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/threading/thread_checker.h"
-#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/browser/api/async_api_function.h"
#include "extensions/browser/api/cast_channel/cast_socket.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
@@ -34,6 +33,7 @@ struct Event;
namespace api {
namespace cast_channel {
+class CastSocketService;
class Logger;
} // namespace cast_channel
} // namespace api
@@ -102,9 +102,6 @@ class CastChannelAsyncApiFunction : public AsyncApiFunction {
CastChannelAsyncApiFunction();
protected:
- typedef ApiResourceManager<cast_channel::CastSocket>::ApiResourceData
- SocketData;
-
~CastChannelAsyncApiFunction() override;
// AsyncApiFunction:
@@ -118,7 +115,7 @@ class CastChannelAsyncApiFunction : public AsyncApiFunction {
// Adds |socket| to |manager_| and returns the new channel_id. |manager_|
// assumes ownership of |socket|.
- int AddSocket(cast_channel::CastSocket* socket);
+ int AddSocket(std::unique_ptr<cast_channel::CastSocket> socket);
// Removes the CastSocket corresponding to |channel_id| from the resource
// manager.
@@ -140,8 +137,8 @@ class CastChannelAsyncApiFunction : public AsyncApiFunction {
// Sets the function result from |channel_info|.
void SetResultFromChannelInfo(const cast_channel::ChannelInfo& channel_info);
- // The collection of CastSocket API resources.
- scoped_refptr<SocketData> sockets_;
+ // Manages creating and removing cast sockets.
+ api::cast_channel::CastSocketService* cast_socket_service_;
};
class CastChannelOpenFunction : public CastChannelAsyncApiFunction {
@@ -161,10 +158,8 @@ class CastChannelOpenFunction : public CastChannelAsyncApiFunction {
// Defines a callback used to send events to the extension's
// EventRouter.
- // Parameter #0 is the extension's ID.
- // Parameter #1 is a scoped pointer to the event payload.
- using EventDispatchCallback =
- base::Callback<void(const std::string&, std::unique_ptr<Event>)>;
+ // Parameter #0 is a scoped pointer to the event payload.
+ using EventDispatchCallback = base::Callback<void(std::unique_ptr<Event>)>;
// Receives incoming messages and errors and provides additional API and
// origin socket context.
« no previous file with comments | « extensions/browser/api/cast_channel/BUILD.gn ('k') | extensions/browser/api/cast_channel/cast_channel_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698