| Index: ppapi/cpp/dev/alarms_dev.h
|
| diff --git a/ppapi/cpp/dev/alarms_dev.h b/ppapi/cpp/dev/alarms_dev.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..61349170362079cd5af1b0f93bb4791a3cb6c62e
|
| --- /dev/null
|
| +++ b/ppapi/cpp/dev/alarms_dev.h
|
| @@ -0,0 +1,140 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef PPAPI_CPP_DEV_ALARMS_DEV_H_
|
| +#define PPAPI_CPP_DEV_ALARMS_DEV_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "ppapi/c/dev/ppb_alarms_dev.h"
|
| +#include "ppapi/cpp/dev/optional_dev.h"
|
| +#include "ppapi/cpp/dev/struct_wrapper_base_dev.h"
|
| +#include "ppapi/cpp/instance_handle.h"
|
| +#include "ppapi/cpp/output_traits.h"
|
| +#include "ppapi/cpp/var.h"
|
| +
|
| +namespace pp {
|
| +
|
| +template <class T>
|
| +class CompletionCallbackWithOutput;
|
| +
|
| +namespace alarms {
|
| +
|
| +// Data types ------------------------------------------------------------------
|
| +class Alarm_Dev
|
| + : public internal::StructWrapperBase<PP_Alarms_Alarm_Dev,
|
| + PP_Alarms_Alarm_Array_Dev> {
|
| + public:
|
| + Alarm_Dev();
|
| +
|
| + Alarm_Dev(const Alarm_Dev& other);
|
| +
|
| + // For taking input parameters from event listeners.
|
| + explicit Alarm_Dev(const PP_Alarms_Alarm_Dev& other);
|
| +
|
| + // For struct / array members.
|
| + // It doesn't take ownership of |storage|, therefore |storage| must live
|
| + // longer than this object. Alarm_Dev(PP_Alarms_Alarm_Dev* storage, NotOwned);
|
| + Alarm_Dev(PP_Alarms_Alarm_Dev* storage, NotOwned);
|
| +
|
| + virtual ~Alarm_Dev();
|
| +
|
| + Alarm_Dev& operator=(const Alarm_Dev& other);
|
| + Alarm_Dev& operator=(const PP_Alarms_Alarm_Dev& other);
|
| +
|
| + std::string name() const;
|
| + void set_name(const std::string& value);
|
| +
|
| + double scheduled_time() const;
|
| + void set_scheduled_time(double value);
|
| +
|
| + bool is_period_in_minutes_set() const;
|
| + void unset_period_in_minutes();
|
| + double period_in_minutes() const;
|
| + void set_period_in_minutes(double value);
|
| +
|
| + private:
|
| + virtual void NotifyStartRawUpdate();
|
| + virtual void NotifyEndRawUpdate();
|
| +
|
| + internal::StringWrapper name_wrapper_;
|
| + Optional<double> period_in_minutes_wrapper_;
|
| +};
|
| +
|
| +class AlarmCreateInfo_Dev
|
| + : public internal::StructWrapperBase<PP_Alarms_AlarmCreateInfo_Dev> {
|
| + public:
|
| + AlarmCreateInfo_Dev();
|
| +
|
| + AlarmCreateInfo_Dev(const AlarmCreateInfo_Dev& other);
|
| +
|
| + // For taking input parameters from event listeners.
|
| + explicit AlarmCreateInfo_Dev(const PP_Alarms_AlarmCreateInfo_Dev& other);
|
| +
|
| + // For struct / array members.
|
| + // It doesn't take ownership of |storage|, therefore |storage| must live
|
| + // longer than this object.
|
| + AlarmCreateInfo_Dev(PP_Alarms_AlarmCreateInfo_Dev* storage, NotOwned);
|
| +
|
| + virtual ~AlarmCreateInfo_Dev();
|
| +
|
| + AlarmCreateInfo_Dev& operator=(const AlarmCreateInfo_Dev& other);
|
| + AlarmCreateInfo_Dev& operator=(const PP_Alarms_AlarmCreateInfo_Dev& other);
|
| +
|
| + bool is_when_set() const;
|
| + void unset_when();
|
| + double when() const;
|
| + void set_when(double value);
|
| +
|
| + bool is_delay_in_minutes_set() const;
|
| + void unset_delay_in_minutes();
|
| + double delay_in_minutes() const;
|
| + void set_delay_in_minutes(double value);
|
| +
|
| + bool is_period_in_minutes_set() const;
|
| + void unset_period_in_minutes();
|
| + double period_in_minutes() const;
|
| + void set_period_in_minutes(double value);
|
| +
|
| + private:
|
| + virtual void NotifyStartRawUpdate();
|
| + virtual void NotifyEndRawUpdate();
|
| +
|
| + Optional<double> when_wrapper_;
|
| + Optional<double> delay_in_minutes_wrapper_;
|
| + Optional<double> period_in_minutes_wrapper_;
|
| +};
|
| +
|
| +// Functions -------------------------------------------------------------------
|
| +class Alarms_Dev {
|
| + public:
|
| + explicit Alarms_Dev(const InstanceHandle& instance);
|
| + ~Alarms_Dev();
|
| +
|
| + void Create(const Optional<std::string>& name,
|
| + const AlarmCreateInfo_Dev& alarm_info);
|
| +
|
| + typedef CompletionCallbackWithOutput<Alarm_Dev> GetCallback;
|
| + int32_t Get(const Optional<std::string>& name, const GetCallback& callback);
|
| +
|
| + typedef CompletionCallbackWithOutput<Array<Alarm_Dev> >
|
| + GetAllCallback;
|
| + int32_t GetAll(const GetAllCallback& callback);
|
| +
|
| + void Clear(const Optional<std::string>& name);
|
| +
|
| + void ClearAll();
|
| +
|
| + private:
|
| + InstanceHandle instance_;
|
| +};
|
| +
|
| +// Events ----------------------------------------------------------------------
|
| +// TODO(yzshen): add onAlarm event.
|
| +
|
| +} // namespace alarms
|
| +} // namespace pp
|
| +
|
| +#endif // PPAPI_CPP_DEV_ALARMS_DEV_H_
|
|
|