| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 MediaSettingsRange_h | 5 #ifndef MediaSettingsRange_h |
| 6 #define MediaSettingsRange_h | 6 #define MediaSettingsRange_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "media/capture/mojo/image_capture.mojom-blink.h" | 9 #include "media/capture/mojo/image_capture.mojom-blink.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class MediaSettingsRange final : public GarbageCollected<MediaSettingsRange>, | 13 class MediaSettingsRange final : public GarbageCollected<MediaSettingsRange>, |
| 14 public ScriptWrappable { | 14 public ScriptWrappable { |
| 15 DEFINE_WRAPPERTYPEINFO(); | 15 DEFINE_WRAPPERTYPEINFO(); |
| 16 | 16 |
| 17 public: | 17 public: |
| 18 static MediaSettingsRange* create(double max, | 18 static MediaSettingsRange* create(double max, |
| 19 double min, | 19 double min, |
| 20 double current, | 20 double current, |
| 21 double step) { | 21 double step) { |
| 22 return new MediaSettingsRange(max, min, current, step); | 22 return new MediaSettingsRange(max, min, current, step); |
| 23 } | 23 } |
| 24 static MediaSettingsRange* create(media::mojom::blink::RangePtr range) { | 24 static MediaSettingsRange* create(media::mojom::blink::RangePtr range) { |
| 25 return MediaSettingsRange::create(range->max, range->min, range->current, | 25 return MediaSettingsRange::create(*range); |
| 26 range->step); | 26 } |
| 27 static MediaSettingsRange* create(const media::mojom::blink::Range& range) { |
| 28 return MediaSettingsRange::create(range.max, range.min, range.current, |
| 29 range.step); |
| 27 } | 30 } |
| 28 | 31 |
| 29 double max() const { return m_max; } | 32 double max() const { return m_max; } |
| 30 double min() const { return m_min; } | 33 double min() const { return m_min; } |
| 31 double current() const { return m_current; } | 34 double current() const { return m_current; } |
| 32 double step() const { return m_step; } | 35 double step() const { return m_step; } |
| 33 | 36 |
| 34 DEFINE_INLINE_TRACE() {} | 37 DEFINE_INLINE_TRACE() {} |
| 35 | 38 |
| 36 private: | 39 private: |
| 37 MediaSettingsRange(double max, double min, double current, double step) | 40 MediaSettingsRange(double max, double min, double current, double step) |
| 38 : m_max(max), m_min(min), m_current(current), m_step(step) {} | 41 : m_max(max), m_min(min), m_current(current), m_step(step) {} |
| 39 | 42 |
| 40 double m_max; | 43 double m_max; |
| 41 double m_min; | 44 double m_min; |
| 42 double m_current; | 45 double m_current; |
| 43 double m_step; | 46 double m_step; |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 } // namespace blink | 49 } // namespace blink |
| 47 | 50 |
| 48 #endif // MediaSettingsRange_h | 51 #endif // MediaSettingsRange_h |
| OLD | NEW |