Commit d994a4c1 authored by A Olsen's avatar A Olsen Committed by Commit Bot

c/b/cros/policy/weeklytime -> cros/policy/weeklytime

Weeklytime package has no dependencies of its own, and few things
depend on it, so it is relatively easy to move out of
src/chrome/browser and into src/chromeos.

This is useful as part of bug 446937 - moving CrosSettings out of
chrome/browser - since CrosSettings depends on this class for the
DeviceOffHoursPolicyController.

Bug: 446937
Change-Id: I9866f341a15f67b452b57cc219b5ca88cd18cfdb
Reviewed-on: https://chromium-review.googlesource.com/1254661
Commit-Queue: A Olsen <olsen@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595797}
parent 93994deb
......@@ -1577,12 +1577,6 @@ source_set("chromeos") {
"policy/value_validation/onc_policy_value_validator_base.h",
"policy/value_validation/onc_user_policy_value_validator.cc",
"policy/value_validation/onc_user_policy_value_validator.h",
"policy/weekly_time/time_utils.cc",
"policy/weekly_time/time_utils.h",
"policy/weekly_time/weekly_time.cc",
"policy/weekly_time/weekly_time.h",
"policy/weekly_time/weekly_time_interval.cc",
"policy/weekly_time/weekly_time_interval.h",
"policy/wildcard_login_checker.cc",
"policy/wildcard_login_checker.h",
"power/auto_screen_brightness/als_reader.h",
......@@ -2270,9 +2264,6 @@ source_set("unit_tests") {
"policy/upload_job_unittest.cc",
"policy/user_cloud_policy_manager_chromeos_unittest.cc",
"policy/user_cloud_policy_store_chromeos_unittest.cc",
"policy/weekly_time/time_utils_unittest.cc",
"policy/weekly_time/weekly_time_interval_unittest.cc",
"policy/weekly_time/weekly_time_unittest.cc",
"power/auto_screen_brightness/als_reader_impl_unittest.cc",
"power/auto_screen_brightness/brightness_monitor_impl_unittest.cc",
"power/auto_screen_brightness/modeller_impl_unittest.cc",
......
......@@ -10,8 +10,8 @@
#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
using base::DictionaryValue;
using base::ListValue;
......
......@@ -13,8 +13,8 @@
#include "base/optional.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace em = enterprise_management;
......
......@@ -8,9 +8,9 @@
#include "base/time/clock.h"
#include "base/values.h"
#include "chrome/browser/chromeos/policy/device_auto_update_time_restrictions_decoder.h"
#include "chrome/browser/chromeos/policy/weekly_time/time_utils.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/time_utils.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chromeos/settings/cros_settings_names.h"
#include "third_party/icu/source/i18n/unicode/timezone.h"
......
......@@ -12,8 +12,8 @@
#include "base/test/simple_test_clock.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h"
#include "chromeos/settings/cros_settings_names.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -15,7 +15,7 @@
#include "base/time/time.h"
#include "chrome/browser/chromeos/login/users/chrome_user_manager_util.h"
#include "chrome/browser/chromeos/policy/off_hours/off_hours_proto_parser.h"
#include "chrome/browser/chromeos/policy/weekly_time/time_utils.h"
#include "chromeos/policy/weekly_time/time_utils.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#include "chromeos/dbus/dbus_thread_manager.h"
......
......@@ -14,7 +14,7 @@
#include "base/time/clock.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/dbus/power_manager_client.h"
#include "chromeos/dbus/system_clock_client.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
......
......@@ -7,8 +7,8 @@
#include <utility>
#include "base/logging.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -7,7 +7,7 @@
#include "base/logging.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/policy/weekly_time/time_utils.h"
#include "chromeos/policy/weekly_time/time_utils.h"
namespace em = enterprise_management;
......
......@@ -11,8 +11,8 @@
#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
namespace base {
......
......@@ -8,8 +8,8 @@
#include "base/logging.h"
#include "base/values.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -466,6 +466,12 @@ component("chromeos") {
"network/tether_constants.cc",
"network/tether_constants.h",
"policy_certificate_provider.h",
"policy/weekly_time/time_utils.cc",
"policy/weekly_time/time_utils.h",
"policy/weekly_time/weekly_time.cc",
"policy/weekly_time/weekly_time.h",
"policy/weekly_time/weekly_time_interval.cc",
"policy/weekly_time/weekly_time_interval.h",
"printing/ppd_cache.cc",
"printing/ppd_cache.h",
"printing/ppd_line_reader.cc",
......@@ -642,6 +648,8 @@ test("chromeos_unittests") {
"//chromeos/services:unit_tests",
"//components/account_id",
"//components/onc",
"//components/policy:generated",
"//components/policy/proto",
"//components/prefs:test_support",
"//components/proxy_config",
"//crypto",
......@@ -732,6 +740,9 @@ test("chromeos_unittests") {
"network/prohibited_technologies_handler_unittest.cc",
"network/proxy/proxy_config_service_impl_unittest.cc",
"network/shill_property_handler_unittest.cc",
"policy/weekly_time/time_utils_unittest.cc",
"policy/weekly_time/weekly_time_interval_unittest.cc",
"policy/weekly_time/weekly_time_unittest.cc",
"printing/ppd_cache_unittest.cc",
"printing/ppd_line_reader_unittest.cc",
"printing/ppd_provider_unittest.cc",
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/policy/weekly_time/time_utils.h"
#include "chromeos/policy/weekly_time/time_utils.h"
#include <algorithm>
#include <memory>
......@@ -12,8 +12,8 @@
#include "base/memory/ptr_util.h"
#include "base/time/clock.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "third_party/icu/source/common/unicode/unistr.h"
#include "third_party/icu/source/common/unicode/utypes.h"
#include "third_party/icu/source/i18n/unicode/gregocal.h"
......
// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_POLICY_WEEKLY_TIME_TIME_UTILS_H_
#define CHROME_BROWSER_CHROMEOS_POLICY_WEEKLY_TIME_TIME_UTILS_H_
#ifndef CHROMEOS_POLICY_WEEKLY_TIME_TIME_UTILS_H_
#define CHROMEOS_POLICY_WEEKLY_TIME_TIME_UTILS_H_
#include <string>
#include <vector>
#include "base/optional.h"
#include "base/strings/string16.h"
#include "chromeos/chromeos_export.h"
#include "third_party/icu/source/i18n/unicode/timezone.h"
namespace base {
......@@ -28,13 +28,13 @@ namespace weekly_time_utils {
// Put time in milliseconds which is added to local time to get GMT time to
// |offset| considering daylight from |clock|. Return true if there was no
// error.
bool GetOffsetFromTimezoneToGmt(const std::string& timezone,
base::Clock* clock,
int* offset);
CHROMEOS_EXPORT bool GetOffsetFromTimezoneToGmt(const std::string& timezone,
base::Clock* clock,
int* offset);
bool GetOffsetFromTimezoneToGmt(const icu::TimeZone& timezone,
base::Clock* clock,
int* offset);
CHROMEOS_EXPORT bool GetOffsetFromTimezoneToGmt(const icu::TimeZone& timezone,
base::Clock* clock,
int* offset);
// The output is in the format "EEEE jj:mm a".
// Example: For a WeeklyTime(4 /* day_of_week */,
......@@ -44,16 +44,17 @@ bool GetOffsetFromTimezoneToGmt(const icu::TimeZone& timezone,
// Similarly, the output will be "Donnerstag 05:00" in a German locale in a GMT
// timezone (there may be slight changes in formatting due to different
// standards in different locales).
base::string16 WeeklyTimeToLocalizedString(const WeeklyTime& weekly_time,
base::Clock* clock);
CHROMEOS_EXPORT base::string16 WeeklyTimeToLocalizedString(
const WeeklyTime& weekly_time,
base::Clock* clock);
// Convert time intervals from |timezone| to GMT timezone. Timezone agnostic
// intervals are not supported.
std::vector<WeeklyTimeInterval> ConvertIntervalsToGmt(
CHROMEOS_EXPORT std::vector<WeeklyTimeInterval> ConvertIntervalsToGmt(
const std::vector<WeeklyTimeInterval>& intervals);
// Return duration till next weekly time interval.
base::TimeDelta GetDeltaTillNextTimeInterval(
CHROMEOS_EXPORT base::TimeDelta GetDeltaTillNextTimeInterval(
const WeeklyTime& current_time,
const std::vector<WeeklyTimeInterval>& weekly_time_intervals);
......@@ -61,11 +62,11 @@ base::TimeDelta GetDeltaTillNextTimeInterval(
// is inside one of the intervals, then the function returns the
// interval that contains |clock->Now()|. Otherwise, return |base::nullopt|.
// The intervals must have a defined
base::Optional<WeeklyTimeInterval> GetIntervalForCurrentTime(
CHROMEOS_EXPORT base::Optional<WeeklyTimeInterval> GetIntervalForCurrentTime(
const std::vector<WeeklyTimeInterval>& intervals,
base::Clock* clock);
} // namespace weekly_time_utils
} // namespace policy
#endif // CHROME_BROWSER_CHROMEOS_POLICY_WEEKLY_TIME_TIME_UTILS_H_
#endif // CHROMEOS_POLICY_WEEKLY_TIME_TIME_UTILS_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/policy/weekly_time/time_utils.h"
#include "chromeos/policy/weekly_time/time_utils.h"
#include <memory>
#include <utility>
......@@ -13,8 +13,8 @@
#include "base/test/icu_test_util.h"
#include "base/test/simple_test_clock.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace em = enterprise_management;
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "base/logging.h"
#include "base/time/time.h"
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_H_
#define CHROME_BROWSER_CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_H_
#ifndef CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_H_
#define CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_H_
#include <memory>
......@@ -11,6 +11,7 @@
#include "base/time/clock.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chromeos/chromeos_export.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
namespace policy {
......@@ -18,7 +19,7 @@ namespace policy {
// WeeklyTime class contains day of week and time. Day of week is number from 1
// to 7 (1 = Monday, 2 = Tuesday, etc.) Time is in milliseconds from the
// beginning of the day.
class WeeklyTime {
class CHROMEOS_EXPORT WeeklyTime {
public:
WeeklyTime(int day_of_week,
int milliseconds,
......@@ -100,4 +101,4 @@ class WeeklyTime {
} // namespace policy
#endif // CHROME_BROWSER_CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_H_
#endif // CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "base/logging.h"
#include "base/time/time.h"
......
......@@ -2,14 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_INTERVAL_H_
#define CHROME_BROWSER_CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_INTERVAL_H_
#ifndef CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_INTERVAL_H_
#define CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_INTERVAL_H_
#include <memory>
#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
namespace policy {
......@@ -18,7 +19,7 @@ namespace policy {
// Interval can be wrapped across the end of the week.
// Interval is empty if start = end. Empty intervals aren't allowed.
// Both WeeklyTimes need to have the same timezone_offset.
class WeeklyTimeInterval {
class CHROMEOS_EXPORT WeeklyTimeInterval {
public:
WeeklyTimeInterval(const WeeklyTime& start, const WeeklyTime& end);
......@@ -70,4 +71,4 @@ class WeeklyTimeInterval {
} // namespace policy
#endif // CHROME_BROWSER_CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_INTERVAL_H_
#endif // CHROMEOS_POLICY_WEEKLY_TIME_WEEKLY_TIME_INTERVAL_H_
......@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time_interval.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include <tuple>
#include <utility>
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include <memory>
#include <tuple>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment