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

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

Issue 690383002: cast channel error cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review changes. Created 6 years, 1 month 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 // Removes the CastSocket corresponding to |channel_id| from the resource 110 // Removes the CastSocket corresponding to |channel_id| from the resource
111 // manager. 111 // manager.
112 void RemoveSocket(int channel_id); 112 void RemoveSocket(int channel_id);
113 113
114 // Sets the function result to a ChannelInfo obtained from the state of 114 // Sets the function result to a ChannelInfo obtained from the state of
115 // |socket|. 115 // |socket|.
116 void SetResultFromSocket(const cast_channel::CastSocket& socket); 116 void SetResultFromSocket(const cast_channel::CastSocket& socket);
117 117
118 // Sets the function result to a ChannelInfo populated with |channel_id| and 118 // Sets the function result to a ChannelInfo populated with |channel_id| and
119 // |error|. 119 // |channel_error|.
120 void SetResultFromError(int channel_id, cast_channel::ChannelError error); 120 void SetResultFromError(int channel_id,
121 cast_channel::ChannelError channel_error);
121 122
122 // Returns the socket corresponding to |channel_id| if one exists, or null 123 // Returns the socket corresponding to |channel_id| if one exists, or null
123 // otherwise. 124 // otherwise.
124 cast_channel::CastSocket* GetSocket(int channel_id); 125 cast_channel::CastSocket* GetSocket(int channel_id);
125 126
126 private: 127 private:
127 // Sets the function result from |channel_info|. 128 // Sets the function result from |channel_info|.
128 void SetResultFromChannelInfo(const cast_channel::ChannelInfo& channel_info); 129 void SetResultFromChannelInfo(const cast_channel::ChannelInfo& channel_info);
129 130
130 // The API resource manager for CastSockets. 131 // The API resource manager for CastSockets.
131 ApiResourceManager<cast_channel::CastSocket>* manager_; 132 ApiResourceManager<cast_channel::CastSocket>* manager_;
132 133
133 // The result of the function. 134 // Whether the api function generated a channel error.
134 cast_channel::ChannelError error_; 135 bool is_channel_error_;
135 }; 136 };
136 137
137 class CastChannelOpenFunction : public CastChannelAsyncApiFunction { 138 class CastChannelOpenFunction : public CastChannelAsyncApiFunction {
138 public: 139 public:
139 CastChannelOpenFunction(); 140 CastChannelOpenFunction();
140 141
141 protected: 142 protected:
142 ~CastChannelOpenFunction() override; 143 ~CastChannelOpenFunction() override;
143 144
144 // AsyncApiFunction: 145 // AsyncApiFunction:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 CAST_CHANNEL_SETAUTHORITYKEYS) 254 CAST_CHANNEL_SETAUTHORITYKEYS)
254 255
255 scoped_ptr<cast_channel::SetAuthorityKeys::Params> params_; 256 scoped_ptr<cast_channel::SetAuthorityKeys::Params> params_;
256 257
257 DISALLOW_COPY_AND_ASSIGN(CastChannelSetAuthorityKeysFunction); 258 DISALLOW_COPY_AND_ASSIGN(CastChannelSetAuthorityKeysFunction);
258 }; 259 };
259 260
260 } // namespace extensions 261 } // namespace extensions
261 262
262 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_ 263 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698