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

Side by Side Diff: extensions/browser/api/webcam_private/webcam_private_api.h

Issue 1281263003: Change webcamPrivate.set/get/reset to async APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Zach's comments. Created 5 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_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_
6 #define EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_ 6 #define EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 ::DeclareFactoryDependencies(); 84 ::DeclareFactoryDependencies();
85 85
86 class WebcamPrivateOpenSerialWebcamFunction : public AsyncExtensionFunction { 86 class WebcamPrivateOpenSerialWebcamFunction : public AsyncExtensionFunction {
87 public: 87 public:
88 WebcamPrivateOpenSerialWebcamFunction(); 88 WebcamPrivateOpenSerialWebcamFunction();
89 DECLARE_EXTENSION_FUNCTION("webcamPrivate.openSerialWebcam", 89 DECLARE_EXTENSION_FUNCTION("webcamPrivate.openSerialWebcam",
90 WEBCAMPRIVATE_OPENSERIALWEBCAM); 90 WEBCAMPRIVATE_OPENSERIALWEBCAM);
91 91
92 protected: 92 protected:
93 ~WebcamPrivateOpenSerialWebcamFunction() override; 93 ~WebcamPrivateOpenSerialWebcamFunction() override;
94
95 // AsyncExtensionFunction:
96 bool RunAsync() override; 94 bool RunAsync() override;
97 95
98 private: 96 private:
99 void OnOpenWebcam(const std::string& webcam_id, bool success); 97 void OnOpenWebcam(const std::string& webcam_id, bool success);
100 98
101 DISALLOW_COPY_AND_ASSIGN(WebcamPrivateOpenSerialWebcamFunction); 99 DISALLOW_COPY_AND_ASSIGN(WebcamPrivateOpenSerialWebcamFunction);
102 }; 100 };
103 101
104 class WebcamPrivateCloseWebcamFunction : public AsyncExtensionFunction { 102 class WebcamPrivateCloseWebcamFunction : public AsyncExtensionFunction {
105 public: 103 public:
106 WebcamPrivateCloseWebcamFunction(); 104 WebcamPrivateCloseWebcamFunction();
107 DECLARE_EXTENSION_FUNCTION("webcamPrivate.closeWebcam", 105 DECLARE_EXTENSION_FUNCTION("webcamPrivate.closeWebcam",
108 WEBCAMPRIVATE_CLOSEWEBCAM); 106 WEBCAMPRIVATE_CLOSEWEBCAM);
109 107
110 protected: 108 protected:
111 ~WebcamPrivateCloseWebcamFunction() override; 109 ~WebcamPrivateCloseWebcamFunction() override;
112
113 // AsyncApiFunction:
114 bool RunAsync() override; 110 bool RunAsync() override;
115 111
116 private: 112 private:
117 DISALLOW_COPY_AND_ASSIGN(WebcamPrivateCloseWebcamFunction); 113 DISALLOW_COPY_AND_ASSIGN(WebcamPrivateCloseWebcamFunction);
118 }; 114 };
119 115
120 class WebcamPrivateSetFunction : public SyncExtensionFunction { 116 class WebcamPrivateSetFunction : public AsyncExtensionFunction {
121 public: 117 public:
122 WebcamPrivateSetFunction(); 118 WebcamPrivateSetFunction();
123 DECLARE_EXTENSION_FUNCTION("webcamPrivate.set", WEBCAMPRIVATE_SET); 119 DECLARE_EXTENSION_FUNCTION("webcamPrivate.set", WEBCAMPRIVATE_SET);
124 120
125 protected: 121 protected:
126 ~WebcamPrivateSetFunction() override; 122 ~WebcamPrivateSetFunction() override;
127 bool RunSync() override; 123 bool RunAsync() override;
128 124
129 private: 125 private:
126 void OnSetWebcamParameters(bool success);
127
130 DISALLOW_COPY_AND_ASSIGN(WebcamPrivateSetFunction); 128 DISALLOW_COPY_AND_ASSIGN(WebcamPrivateSetFunction);
131 }; 129 };
132 130
133 class WebcamPrivateGetFunction : public SyncExtensionFunction { 131 class WebcamPrivateGetFunction : public AsyncExtensionFunction {
134 public: 132 public:
135 WebcamPrivateGetFunction(); 133 WebcamPrivateGetFunction();
136 DECLARE_EXTENSION_FUNCTION("webcamPrivate.get", WEBCAMPRIVATE_GET); 134 DECLARE_EXTENSION_FUNCTION("webcamPrivate.get", WEBCAMPRIVATE_GET);
137 135
138 protected: 136 protected:
139 ~WebcamPrivateGetFunction() override; 137 ~WebcamPrivateGetFunction() override;
140 bool RunSync() override; 138 bool RunAsync() override;
141 139
142 private: 140 private:
141 enum InquiryType {
142 INQUIRY_PAN,
143 INQUIRY_TILT,
144 INQUIRY_ZOOM,
145 };
146 void OnGetWebcamParameters(InquiryType type, bool success, int value);
147
148 int pan_;
149 int tilt_;
150 int zoom_;
151 bool get_pan_;
152 bool get_tilt_;
153 bool get_zoom_;
154 bool success_;
155
143 DISALLOW_COPY_AND_ASSIGN(WebcamPrivateGetFunction); 156 DISALLOW_COPY_AND_ASSIGN(WebcamPrivateGetFunction);
144 }; 157 };
145 158
146 class WebcamPrivateResetFunction : public SyncExtensionFunction { 159 class WebcamPrivateResetFunction : public AsyncExtensionFunction {
147 public: 160 public:
148 WebcamPrivateResetFunction(); 161 WebcamPrivateResetFunction();
149 DECLARE_EXTENSION_FUNCTION("webcamPrivate.reset", WEBCAMPRIVATE_RESET); 162 DECLARE_EXTENSION_FUNCTION("webcamPrivate.reset", WEBCAMPRIVATE_RESET);
150 163
151 protected: 164 protected:
152 ~WebcamPrivateResetFunction() override; 165 ~WebcamPrivateResetFunction() override;
153 bool RunSync() override; 166 bool RunAsync() override;
154 167
155 private: 168 private:
169 void OnResetWebcam(bool success);
170
156 DISALLOW_COPY_AND_ASSIGN(WebcamPrivateResetFunction); 171 DISALLOW_COPY_AND_ASSIGN(WebcamPrivateResetFunction);
157 }; 172 };
158 173
159 } // namespace extensions 174 } // namespace extensions
160 175
161 #endif // EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_ 176 #endif // EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/webcam_private/webcam.h ('k') | extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698