weblayer_variations_service_client.cc 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright 2019 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. #include "weblayer/browser/weblayer_variations_service_client.h"
  5. #include "build/build_config.h"
  6. #include "components/version_info/channel.h"
  7. #include "components/version_info/version_info.h"
  8. #include "services/network/public/cpp/shared_url_loader_factory.h"
  9. #include "weblayer/browser/browser_process.h"
  10. #include "weblayer/browser/system_network_context_manager.h"
  11. #if BUILDFLAG(IS_ANDROID)
  12. #include "components/version_info/android/channel_getter.h"
  13. #endif
  14. using version_info::Channel;
  15. namespace weblayer {
  16. WebLayerVariationsServiceClient::WebLayerVariationsServiceClient(
  17. SystemNetworkContextManager* network_context_manager)
  18. : network_context_manager_(network_context_manager) {
  19. DCHECK(network_context_manager_);
  20. }
  21. WebLayerVariationsServiceClient::~WebLayerVariationsServiceClient() = default;
  22. base::Version WebLayerVariationsServiceClient::GetVersionForSimulation() {
  23. return version_info::GetVersion();
  24. }
  25. scoped_refptr<network::SharedURLLoaderFactory>
  26. WebLayerVariationsServiceClient::GetURLLoaderFactory() {
  27. return network_context_manager_->GetSharedURLLoaderFactory();
  28. }
  29. network_time::NetworkTimeTracker*
  30. WebLayerVariationsServiceClient::GetNetworkTimeTracker() {
  31. return BrowserProcess::GetInstance()->GetNetworkTimeTracker();
  32. }
  33. Channel WebLayerVariationsServiceClient::GetChannel() {
  34. #if BUILDFLAG(IS_ANDROID)
  35. return version_info::android::GetChannel();
  36. #else
  37. return version_info::Channel::UNKNOWN;
  38. #endif
  39. }
  40. bool WebLayerVariationsServiceClient::OverridesRestrictParameter(
  41. std::string* parameter) {
  42. return false;
  43. }
  44. bool WebLayerVariationsServiceClient::IsEnterprise() {
  45. return false;
  46. }
  47. } // namespace weblayer