Skip to content

Commit

Permalink
cryptauth: Move the chrome/browser implementation to c/b/chromeos.
Browse files Browse the repository at this point in the history
Since this feature is CrOS-only.

Bug: none
Test: none
Change-Id: I85efa428462e6073c7da284b5282e287158c29e5
Reviewed-on: https://chromium-review.googlesource.com/961664
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Dan Erat <derat@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: anthonyvd <anthonyvd@chromium.org>
Commit-Queue: James Hawkins <jhawkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543121}
  • Loading branch information
James Hawkins authored and Commit Bot committed Mar 14, 2018
1 parent 3ecc16b commit 88b034e
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 28 deletions.
6 changes: 0 additions & 6 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2371,10 +2371,6 @@ jumbo_split_static_library("browser") {
"chrome_browser_main_posix.h",
"chrome_process_singleton.cc",
"chrome_process_singleton.h",
"cryptauth/chrome_cryptauth_service.cc",
"cryptauth/chrome_cryptauth_service.h",
"cryptauth/chrome_cryptauth_service_factory.cc",
"cryptauth/chrome_cryptauth_service_factory.h",
"custom_handlers/register_protocol_handler_permission_request.cc",
"custom_handlers/register_protocol_handler_permission_request.h",
"diagnostics/diagnostics_controller.cc",
Expand Down Expand Up @@ -2785,8 +2781,6 @@ jumbo_split_static_library("browser") {
"//chrome/browser/resources:component_extension_resources",
"//chrome/browser/search:generated",
"//chrome/common/importer:interfaces",
"//components/cryptauth",
"//components/cryptauth/proto",
"//components/feedback",
"//components/keep_alive_registry",
"//components/vector_icons",
Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/chromeos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ source_set("chromeos") {
"//components/crash/content/app",
"//components/crx_file",
"//components/cryptauth",
"//components/cryptauth/proto",
"//components/device_event_log",
"//components/download/content/public",
"//components/drive",
Expand Down Expand Up @@ -489,6 +490,10 @@ source_set("chromeos") {
"chrome_browser_main_chromeos.h",
"chrome_service_name.cc",
"chrome_service_name.h",
"cryptauth/chrome_cryptauth_service.cc",
"cryptauth/chrome_cryptauth_service.h",
"cryptauth/chrome_cryptauth_service_factory.cc",
"cryptauth/chrome_cryptauth_service_factory.h",
"customization/customization_document.cc",
"customization/customization_document.h",
"customization/customization_wallpaper_downloader.cc",
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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/cryptauth/chrome_cryptauth_service.h"
#include "chrome/browser/chromeos/cryptauth/chrome_cryptauth_service.h"

#include "base/guid.h"
#include "base/memory/ptr_util.h"
Expand Down Expand Up @@ -43,6 +43,8 @@
#include "ui/gfx/geometry/rect.h"
#endif

namespace chromeos {

namespace {

std::string GetDeviceId() {
Expand Down Expand Up @@ -359,3 +361,5 @@ void ChromeCryptAuthService::OnPrefsChanged() {
// off.
PerformEnrollmentAndDeviceSyncIfPossible();
}

} // namespace chromeos
Original file line number Diff line number Diff line change
Expand Up @@ -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_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_H_
#define CHROME_BROWSER_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_H_
#ifndef CHROME_BROWSER_CHROMEOS_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_H_
#define CHROME_BROWSER_CHROMEOS_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_H_

#include <memory>

Expand All @@ -23,6 +23,8 @@ namespace cryptauth {
class CryptAuthGCMManager;
} // namespace cryptauth

namespace chromeos {

// Implementation of cryptauth::CryptAuthService.
class ChromeCryptAuthService
: public KeyedService,
Expand Down Expand Up @@ -90,4 +92,6 @@ class ChromeCryptAuthService
DISALLOW_COPY_AND_ASSIGN(ChromeCryptAuthService);
};

#endif // CHROME_BROWSER_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_H_
} // namespace chromeos

#endif // CHROME_BROWSER_CHROMEOS_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/chromeos/cryptauth/chrome_cryptauth_service_factory.h"

#include "chrome/browser/cryptauth/chrome_cryptauth_service.h"
#include "chrome/browser/chromeos/cryptauth/chrome_cryptauth_service.h"
#include "chrome/browser/gcm/gcm_profile_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/pref_registry/pref_registry_syncable.h"

namespace chromeos {

// static
cryptauth::CryptAuthService*
ChromeCryptAuthServiceFactory::GetForBrowserContext(
Expand Down Expand Up @@ -46,3 +48,5 @@ void ChromeCryptAuthServiceFactory::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
cryptauth::CryptAuthService::RegisterProfilePrefs(registry);
}

} // namespace chromeos
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_FACTORY_H_
#define CHROME_BROWSER_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_FACTORY_H_
#ifndef CHROME_BROWSER_CHROMEOS_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_FACTORY_H_
#define CHROME_BROWSER_CHROMEOS_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_FACTORY_H_

#include "base/macros.h"
#include "base/memory/singleton.h"
#include "components/cryptauth/cryptauth_service.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"

namespace chromeos {

// Factory which is used to access the CryptAuthService singleton.
class ChromeCryptAuthServiceFactory : public BrowserContextKeyedServiceFactory {
public:
Expand All @@ -33,4 +35,6 @@ class ChromeCryptAuthServiceFactory : public BrowserContextKeyedServiceFactory {
DISALLOW_COPY_AND_ASSIGN(ChromeCryptAuthServiceFactory);
};

#endif // CHROME_BROWSER_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_FACTORY_H_
} // namespace chromeos

#endif // CHROME_BROWSER_CHROMEOS_CRYPTAUTH_CHROME_CRYPTAUTH_SERVICE_FACTORY_H_
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include "base/sys_info.h"
#include "base/version.h"
#include "build/build_config.h"
#include "chrome/browser/chromeos/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_service.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_regular.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_signin_chromeos.h"
#include "chrome/browser/chromeos/login/easy_unlock/secure_message_delegate_chromeos.h"
#include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
Expand Down Expand Up @@ -129,8 +129,8 @@ ChromeProximityAuthClient::GetCryptAuthDeviceManager() {
}

cryptauth::CryptAuthService* ChromeProximityAuthClient::GetCryptAuthService() {
return ChromeCryptAuthServiceFactory::GetInstance()->GetForBrowserContext(
profile_);
return chromeos::ChromeCryptAuthServiceFactory::GetInstance()
->GetForBrowserContext(profile_);
}

std::string ChromeProximityAuthClient::GetLocalDevicePublicKey() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
#include "base/command_line.h"
#include "base/memory/singleton.h"
#include "build/build_config.h"
#include "chrome/browser/chromeos/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_app_manager.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_service.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_regular.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_service_signin_chromeos.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_factory.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/chromeos/login/easy_unlock/chrome_proximity_auth_client.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_notification_controller.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.h"
#include "chrome/browser/chromeos/login/session/user_session_manager.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/gcm/gcm_profile_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/tether/tether_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/tether/tether_service_factory.h"
#include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ash/network/tether_notification_presenter.h"
#include "chrome/common/chrome_features.h"
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/chromeos/tether/tether_service_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "base/command_line.h"
#include "base/memory/singleton.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/chromeos/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/chromeos/tether/fake_tether_service.h"
#include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_switches.h"
Expand Down Expand Up @@ -36,7 +36,7 @@ TetherServiceFactory::TetherServiceFactory()
: BrowserContextKeyedServiceFactory(
"TetherService",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(ChromeCryptAuthServiceFactory::GetInstance());
DependsOn(chromeos::ChromeCryptAuthServiceFactory::GetInstance());
}

TetherServiceFactory::~TetherServiceFactory() {}
Expand All @@ -50,7 +50,7 @@ KeyedService* TetherServiceFactory::BuildServiceInstanceFor(
FakeTetherService* fake_tether_service = new FakeTetherService(
Profile::FromBrowserContext(context),
chromeos::DBusThreadManager::Get()->GetPowerManagerClient(),
ChromeCryptAuthServiceFactory::GetForBrowserContext(
chromeos::ChromeCryptAuthServiceFactory::GetForBrowserContext(
Profile::FromBrowserContext(context)),
chromeos::NetworkHandler::Get()->network_state_handler(),
session_manager::SessionManager::Get());
Expand All @@ -67,7 +67,7 @@ KeyedService* TetherServiceFactory::BuildServiceInstanceFor(
return new TetherService(
Profile::FromBrowserContext(context),
chromeos::DBusThreadManager::Get()->GetPowerManagerClient(),
ChromeCryptAuthServiceFactory::GetForBrowserContext(
chromeos::ChromeCryptAuthServiceFactory::GetForBrowserContext(
Profile::FromBrowserContext(context)),
chromeos::NetworkHandler::Get()->network_state_handler(),
session_manager::SessionManager::Get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@
#include "chrome/browser/android/data_usage/data_use_ui_tab_model_factory.h"
#include "chrome/browser/android/search_permissions/search_permissions_service.h"
#else
#include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/ui/global_error/global_error_service_factory.h"
#include "chrome/browser/ui/webui/media_router/media_router_ui_service_factory.h"
#include "chrome/browser/usb/usb_chooser_context_factory.h"
#endif

#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/cryptauth/chrome_cryptauth_service_factory.h"
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h"
#include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
#include "chrome/browser/chromeos/policy/recommendation_restorer_factory.h"
Expand Down Expand Up @@ -224,8 +224,8 @@ EnsureBrowserContextKeyedServiceFactoriesBuilt() {
android::DataUseUITabModelFactory::GetInstance();
#endif
ChromeBrowsingDataRemoverDelegateFactory::GetInstance();
#if !defined(OS_ANDROID)
ChromeCryptAuthServiceFactory::GetInstance();
#if defined(OS_CHROMEOS)
chromeos::ChromeCryptAuthServiceFactory::GetInstance();
#endif
ChromeSigninClientFactory::GetInstance();
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OS_CHROMEOS)
Expand Down

0 comments on commit 88b034e

Please sign in to comment.