Alex Deymo | aea4c1c | 2015-08-19 20:24:43 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2014 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 16 | |
Gilad Arnold | 48415f1 | 2014-06-27 07:10:58 -0700 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_UPDATE_MANAGER_TIME_PROVIDER_H_ |
| 18 | #define UPDATE_ENGINE_UPDATE_MANAGER_TIME_PROVIDER_H_ |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 19 | |
Alex Vakulenko | 75039d7 | 2014-03-25 12:36:28 -0700 | [diff] [blame] | 20 | #include <base/time/time.h> |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 21 | |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 22 | #include "update_engine/update_manager/provider.h" |
| 23 | #include "update_engine/update_manager/variable.h" |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 24 | |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 25 | namespace chromeos_update_manager { |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 26 | |
| 27 | // Provider for time related information. |
| 28 | class TimeProvider : public Provider { |
| 29 | public: |
Alex Deymo | 610277e | 2014-11-11 21:18:11 -0800 | [diff] [blame] | 30 | ~TimeProvider() override {} |
David Zeuthen | 21716e2 | 2014-04-23 15:42:05 -0700 | [diff] [blame] | 31 | |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 32 | // Returns the current date. The time of day component will be zero. |
David Zeuthen | 21716e2 | 2014-04-23 15:42:05 -0700 | [diff] [blame] | 33 | virtual Variable<base::Time>* var_curr_date() = 0; |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 34 | |
| 35 | // Returns the current hour (0 to 23) in local time. The type is int to keep |
| 36 | // consistent with base::Time. |
David Zeuthen | 21716e2 | 2014-04-23 15:42:05 -0700 | [diff] [blame] | 37 | virtual Variable<int>* var_curr_hour() = 0; |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 38 | |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 39 | protected: |
| 40 | TimeProvider() {} |
| 41 | |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 42 | private: |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 43 | DISALLOW_COPY_AND_ASSIGN(TimeProvider); |
| 44 | }; |
| 45 | |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 46 | } // namespace chromeos_update_manager |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 47 | |
Gilad Arnold | 48415f1 | 2014-06-27 07:10:58 -0700 | [diff] [blame] | 48 | #endif // UPDATE_ENGINE_UPDATE_MANAGER_TIME_PROVIDER_H_ |