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

Side by Side Diff: ppapi/proxy/image_capture_resource.h

Issue 848863002: PPAPI: implement GetSupportedPreviewSizes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a compile error Created 5 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_
6 #define PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
dmichael (off chromium) 2015/02/09 22:27:00 nit: Not using this header
Justin Chuang 2015/02/10 16:01:02 Done.
10 #include "ppapi/c/pp_size.h"
11 #include "ppapi/proxy/connection.h"
12 #include "ppapi/proxy/plugin_resource.h"
13 #include "ppapi/proxy/ppapi_proxy_export.h"
14 #include "ppapi/shared_impl/resource.h"
15 #include "ppapi/thunk/ppb_image_capture_api.h"
16
17 namespace ppapi {
18 namespace proxy {
19
20 class CameraCapabilitiesResource;
21 class ImageCaptureConfigResource;
22
23 class PPAPI_PROXY_EXPORT ImageCaptureResource
24 : public PluginResource,
25 public thunk::PPB_ImageCapture_API {
26 public:
27 ImageCaptureResource(Connection connection, PP_Instance instance);
28 virtual ~ImageCaptureResource();
dmichael (off chromium) 2015/02/09 22:27:00 This should be override (not marked virtual). Same
Justin Chuang 2015/02/10 16:01:03 Done. Thank you! I haven't noticed this rule also
29
30 // Resource overrides:
31 virtual thunk::PPB_ImageCapture_API* AsPPB_ImageCapture_API() override {
dmichael (off chromium) 2015/02/09 22:27:00 We should only mark a function virtual OR override
Justin Chuang 2015/02/10 16:01:02 Done in this file and the other files.
32 return this;
33 }
34
35 // PPB_ImageCapture_API overrides:
36 virtual int32_t Open(PP_Var device_id,
37 scoped_refptr<TrackedCallback> callback) override;
38 virtual void Close() override;
39 virtual int32_t GetCameraCapabilities(
40 PP_Resource* capabilities,
41 scoped_refptr<TrackedCallback> callback) override;
dmichael (off chromium) 2015/02/09 22:27:00 nit: Maybe slightly prefer const scoped_refptr<>&
Justin Chuang 2015/02/10 16:01:03 Done.
42
43 private:
44 enum OpenState { BEFORE_OPEN, OPENED, CLOSED };
45
46 // Host -> plugin messages.
47 void OnPluginMsgGetPreviewSizesReply(
48 const ResourceMessageReplyParams& params,
49 const std::vector<PP_Size>& preview_sizes);
50
51 // reply to open
dmichael (off chromium) 2015/02/09 22:27:00 You could leave out this comment and just put this
Justin Chuang 2015/02/10 16:01:03 Removed the comments and blank line.
52 void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params);
53
54 // other
dmichael (off chromium) 2015/02/09 22:27:00 unnecessary comment
Justin Chuang 2015/02/10 16:01:03 Done.
55 bool IsOpened() const { return open_state_ == OPENED; }
dmichael (off chromium) 2015/02/09 22:27:00 nit: I'm used to seeing simple inlined functions l
Justin Chuang 2015/02/10 16:01:02 It's true. Done.
56
57 // Holds a reference of the callback so that Close() can cancel it.
58 scoped_refptr<TrackedCallback> open_callback_;
59 OpenState open_state_;
60
61 PP_Resource* get_capabilities_output_;
62 scoped_refptr<TrackedCallback> get_capabilities_callback_;
63 scoped_refptr<CameraCapabilitiesResource> camera_capabilities_;
64
65 DISALLOW_COPY_AND_ASSIGN(ImageCaptureResource);
66 };
67
68 } // namespace proxy
69 } // namespace ppapi
70
71 #endif // PPAPI_PROXY_IMAGE_CAPTURE_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698