Skip to content

Commit

Permalink
[sync] Componentize switches used by ProfileSyncService
Browse files Browse the repository at this point in the history
This CL componentizes switches used by ProfileSyncService and
ProfileSyncComponentsFactoryImpl into a new browser_sync component in
anticipation of componentizing those files into that component.

These switches are used by //cloud_print/service, and so are componentized into
//components/browser_sync/common to allow for that dependency without
//cloud_print/service incurring a dependency on the browser-side code (e.g.,
ProfileSyncService) once that code is componentized.

BUG=512825
TBR=jochen

Review URL: https://codereview.chromium.org/1408003010

Cr-Commit-Position: refs/heads/master@{#358048}
  • Loading branch information
colinblundell authored and Commit bot committed Nov 5, 2015
1 parent 2bccc2c commit 373c28c
Show file tree
Hide file tree
Showing 31 changed files with 107 additions and 18 deletions.
1 change: 1 addition & 0 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ source_set("browser") {
"//components/autofill/core/browser",
"//components/bookmarks/browser",
"//components/bookmarks/managed",
"//components/browser_sync/common",
"//components/captive_portal",
"//components/certificate_reporting",
"//components/cloud_devices/common",
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ include_rules = [
"+components/bookmarks/common",
"+components/bookmarks/managed",
"+components/bookmarks/test",
"+components/browser_sync",
"+components/browser_watcher",
"+components/browsing_data",
"+components/cdm/browser",
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/google_chrome_strings.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/cloud_devices/common/cloud_devices_switches.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h"
#include "components/dom_distiller/core/dom_distiller_switches.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/android/chrome_startup_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "base/sys_info.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_switches.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/dom_distiller/core/dom_distiller_switches.h"
#include "media/base/media_switches.h"

Expand Down
1 change: 1 addition & 0 deletions chrome/browser/chromeos/chrome_browser_main_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
#include "chromeos/network/portal_detector/network_portal_detector_stub.h"
#include "chromeos/system/statistics_provider.h"
#include "chromeos/tpm/tpm_token_loader.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/device_event_log/device_event_log.h"
#include "components/metrics/metrics_service.h"
#include "components/ownership/owner_key_util.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "chromeos/login/auth/user_context.h"
#include "components/app_modal/javascript_app_modal_dialog.h"
#include "components/app_modal/native_app_modal_dialog.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/signin/core/account_id/account_id.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/extensions/api/gcm/gcm_apitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "extensions/test/result_catcher.h"

using extensions::ResultCatcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "chrome/test/base/testing_profile.h"
#include "chromeos/system/fake_statistics_provider.h"
#include "chromeos/system/statistics_provider.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager_base.h"
#include "components/sync_driver/pref_names.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "components/autofill/core/browser/webdata/autofill_profile_data_type_controller.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/dom_distiller/core/dom_distiller_features.h"
#include "components/history/core/browser/history_delete_directives_data_type_controller.h"
#include "components/history/core/browser/typed_url_change_processor.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_profile.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/sync_driver/data_type_controller.h"
#include "components/sync_driver/signin_manager_wrapper.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/sync/profile_sync_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
#include "chrome/browser/sync/glue/sync_backend_host.h"
#include "chrome/browser/sync/glue/sync_backend_host_impl.h"
#include "chrome/browser/sync/sync_type_preference_provider.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/history/core/browser/typed_url_data_type_controller.h"
#include "components/invalidation/impl/invalidation_prefs.h"
#include "components/invalidation/public/invalidation_service.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_profile.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down
1 change: 1 addition & 0 deletions chrome/browser/sync/profile_sync_service_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/invalidation/impl/profile_invalidation_provider.h"
#include "components/invalidation/public/invalidation_service.h"
#include "components/signin/core/browser/account_tracker_service.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/wifi_credentials_helper.h"
#include "chrome/common/chrome_switches.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/wifi_sync/wifi_credential.h"
#include "components/wifi_sync/wifi_security_class.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/wifi_credentials_helper.h"
#include "chrome/common/chrome_switches.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/wifi_sync/wifi_credential.h"
#include "components/wifi_sync/wifi_security_class.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/fake_signin_manager.h"
#include "content/public/browser/navigation_entry.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ui/sync/sync_promo_ui_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_profile.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -3069,6 +3069,7 @@
'../components/components.gyp:autofill_core_browser',
'../components/components.gyp:bookmarks_browser',
'../components/components.gyp:bookmarks_managed',
'../components/components.gyp:browser_sync_common',
'../components/components.gyp:captive_portal',
'../components/components.gyp:cloud_devices_common',
'../components/components.gyp:component_metrics_proto',
Expand Down
13 changes: 0 additions & 13 deletions chrome/common/chrome_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -339,16 +339,6 @@ const char kDisableSessionCrashedBubble[] = "disable-session-crashed-bubble";
// and allocates certain resources accordingly.
const char kDisableSiteEngagementService[] = "disable-site-engagement-service";

// Disables syncing browser data to a Google Account.
const char kDisableSync[] = "disable-sync";

// Disables syncing one or more sync data types that are on by default.
// See sync/internal_api/public/base/model_type.h for possible types. Types
// should be comma separated, and follow the naming convention for string
// representation of model types, e.g.:
// --disable-synctypes='Typed URLs, Bookmarks, Autofill Profiles'
const char kDisableSyncTypes[] = "disable-sync-types";

// Disables Web Notification custom layouts.
const char kDisableWebNotificationCustomLayouts[] =
"disable-web-notification-custom-layouts";
Expand Down Expand Up @@ -572,9 +562,6 @@ const char kEnableWebNotificationCustomLayouts[] =
// crbug.com/529950
const char kEnableWebUsbOnAnyOrigin[] = "enable-webusb-on-any-origin";

// Enables synchronizing WiFi credentials across devices, using Chrome Sync.
const char kEnableWifiCredentialSync[] = "enable-wifi-credential-sync";

// Values for the kExtensionContentVerification flag.
// See ContentVerifierDelegate::Mode for more explanation.
const char kExtensionContentVerificationBootstrap[] = "bootstrap";
Expand Down
3 changes: 0 additions & 3 deletions chrome/common/chrome_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ extern const char kDisableQuic[];
extern const char kDisableQuicPortSelection[];
extern const char kDisableSessionCrashedBubble[];
extern const char kDisableSiteEngagementService[];
extern const char kDisableSync[];
extern const char kDisableSyncTypes[];
extern const char kDisableWebNotificationCustomLayouts[];
extern const char kDisableWebResources[];
extern const char kDisableZeroBrowsersOpenForTests[];
Expand Down Expand Up @@ -161,7 +159,6 @@ extern const char kEnableUserAlternateProtocolPorts[];
extern const char kEnableWebAppFrame[];
extern const char kEnableWebNotificationCustomLayouts[];
extern const char kEnableWebUsbOnAnyOrigin[];
extern const char kEnableWifiCredentialSync[];
extern const char kExtensionContentVerificationBootstrap[];
extern const char kExtensionContentVerificationEnforceStrict[];
extern const char kExtensionContentVerificationEnforce[];
Expand Down
1 change: 1 addition & 0 deletions cloud_print/DEPS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include_rules = [
"+chrome/common",
"+chrome/installer/launcher_support",
"+components/browser_sync/common",
"+components/cloud_devices/common",
"+content/public/common",
"+google_apis",
Expand Down
1 change: 1 addition & 0 deletions cloud_print/service/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ source_set("lib") {
"//base/third_party/dynamic_annotations",
"//chrome/common:constants",
"//cloud_print/common",
"//components/browser_sync/common",
"//components/cloud_devices/common",
"//content/public/common:static_switches",
"//google_apis",
Expand Down
1 change: 1 addition & 0 deletions cloud_print/service/service.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
'<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/base/base.gyp:base_static',
'<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'<(DEPTH)/components/components.gyp:browser_sync_common',
'<(DEPTH)/components/components.gyp:cloud_devices_common',
'<(DEPTH)/google_apis/google_apis.gyp:google_apis',
'<(DEPTH)/ipc/ipc.gyp:ipc',
Expand Down
1 change: 1 addition & 0 deletions cloud_print/service/win/chrome_launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "cloud_print/common/win/cloud_print_utils.h"
#include "cloud_print/service/service_constants.h"
#include "cloud_print/service/win/service_utils.h"
#include "components/browser_sync/common/browser_sync_switches.h"
#include "components/cloud_devices/common/cloud_devices_urls.h"
#include "content/public/common/content_switches.h"
#include "google_apis/gaia/gaia_urls.h"
Expand Down
1 change: 1 addition & 0 deletions components/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ group("all_components") {
"//components/bookmarks/common",
"//components/bookmarks/managed",
"//components/bookmarks/test",
"//components/browser_sync/common",
"//components/bubble",
"//components/captive_portal",
"//components/chrome_apps",
Expand Down
24 changes: 24 additions & 0 deletions components/browser_sync.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2015 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.

{
'targets': [
{
# GN version: //components/browser_sync_common
'target_name': 'browser_sync_common',
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
],
'include_dirs': [
'..',
],
'sources': [
# Note: file list duplicated in GN build.
'browser_sync/common/browser_sync_switches.cc',
'browser_sync/common/browser_sync_switches.h',
],
},
],
}
3 changes: 3 additions & 0 deletions components/browser_sync/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pavely@chromium.org
stanisc@chromium.org
zea@chromium.org
16 changes: 16 additions & 0 deletions components/browser_sync/common/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2015 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.

import("//build/config/features.gni")

source_set("common") {
sources = [
"browser_sync_switches.cc",
"browser_sync_switches.h",
]

deps = [
"//base",
]
}
22 changes: 22 additions & 0 deletions components/browser_sync/common/browser_sync_switches.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2015 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.

#include "components/browser_sync/common/browser_sync_switches.h"

namespace switches {

// Disables syncing browser data to a Google Account.
const char kDisableSync[] = "disable-sync";

// Disables syncing one or more sync data types that are on by default.
// See sync/internal_api/public/base/model_type.h for possible types. Types
// should be comma separated, and follow the naming convention for string
// representation of model types, e.g.:
// --disable-synctypes='Typed URLs, Bookmarks, Autofill Profiles'
const char kDisableSyncTypes[] = "disable-sync-types";

// Enables synchronizing WiFi credentials across devices, using Chrome Sync.
const char kEnableWifiCredentialSync[] = "enable-wifi-credential-sync";

} // namespace switches
18 changes: 18 additions & 0 deletions components/browser_sync/common/browser_sync_switches.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2015 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.

// Defines all the command-line switches used by //components/browser_sync.

#ifndef COMPONENTS_BROWSER_SYNC_COMMON_BROWSER_SYNC_SWITCHES_H_
#define COMPONENTS_BROWSER_SYNC_COMMON_BROWSER_SYNC_SWITCHES_H_

namespace switches {

extern const char kDisableSync[];
extern const char kDisableSyncTypes[];
extern const char kEnableWifiCredentialSync[];

} // namespace switches

#endif // COMPONENTS_BROWSER_SYNC_COMMON_BROWSER_SYNC_SWITCHES_H_
1 change: 1 addition & 0 deletions components/components.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'auto_login_parser.gypi',
'autofill.gypi',
'bookmarks.gypi',
'browser_sync.gypi',
'bubble.gypi',
'captive_portal.gypi',
'certificate_reporting.gypi',
Expand Down

0 comments on commit 373c28c

Please sign in to comment.