Componentize bookmark-related sync files into new component
This CL componentizes files related to syncing of bookmarks into a new
sync_bookmarks component. The motivation is for clean iOS integration. The files
have no problematic dependencies and so can be componentized as-is.
The decision to create a standalone component rather than folding these files
into the bookmarks component is that it is undesirable to introduce a
sync-related dependency in the core bookmark component.
BUG=511299,511293,511287
TBR=thestig
Review URL: https://codereview.chromium.org/1395563002
Cr-Commit-Position: refs/heads/master@{#353065}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 783d064b..33b567c 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -155,6 +155,7 @@
"//components/startup_metric_utils",
"//components/strings",
"//components/suggestions",
+ "//components/sync_bookmarks",
"//components/sync_driver",
"//components/tracing:startup_tracing",
"//components/translate/core/browser",
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index cf4b3570..c6881f9 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -93,6 +93,7 @@
"+components/startup_metric_utils",
"+components/storage_monitor",
"+components/suggestions",
+ "+components/sync_bookmarks",
"+components/sync_driver",
"+components/syncable_prefs",
"+components/tracing",
diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc
index 7cd3b0a..55424df 100644
--- a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/bookmark_data_type_controller_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/sync/glue/bookmark_data_type_controller.h"
+#include "components/sync_bookmarks/bookmark_data_type_controller.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.cc b/chrome/browser/sync/profile_sync_components_factory_impl.cc
index 76907fc..077da72 100644
--- a/chrome/browser/sync/profile_sync_components_factory_impl.cc
+++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc
@@ -11,9 +11,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/glue/autofill_data_type_controller.h"
#include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h"
-#include "chrome/browser/sync/glue/bookmark_change_processor.h"
-#include "chrome/browser/sync/glue/bookmark_data_type_controller.h"
-#include "chrome/browser/sync/glue/bookmark_model_associator.h"
#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h"
#include "chrome/browser/sync/glue/history_delete_directives_data_type_controller.h"
#include "chrome/browser/sync/glue/local_device_info_provider_impl.h"
@@ -32,6 +29,9 @@
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/dom_distiller/core/dom_distiller_features.h"
+#include "components/sync_bookmarks/bookmark_change_processor.h"
+#include "components/sync_bookmarks/bookmark_data_type_controller.h"
+#include "components/sync_bookmarks/bookmark_model_associator.h"
#include "components/sync_driver/data_type_manager_impl.h"
#include "components/sync_driver/device_info_data_type_controller.h"
#include "components/sync_driver/glue/typed_url_model_associator.h"
diff --git a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
index 226c965..44effc4 100644
--- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
@@ -28,14 +28,14 @@
#include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/history/history_service_factory.h"
-#include "chrome/browser/sync/glue/bookmark_change_processor.h"
-#include "chrome/browser/sync/glue/bookmark_model_associator.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_profile.h"
#include "components/bookmarks/browser/base_bookmark_model_observer.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/managed/managed_bookmark_service.h"
#include "components/bookmarks/test/bookmark_test_helpers.h"
+#include "components/sync_bookmarks/bookmark_change_processor.h"
+#include "components/sync_bookmarks/bookmark_model_associator.h"
#include "components/sync_driver/data_type_error_handler.h"
#include "components/sync_driver/data_type_error_handler_mock.h"
#include "components/sync_driver/fake_sync_client.h"
diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc
index 28fca472..aa9aba7 100644
--- a/chrome/browser/sync/test/integration/bookmarks_helper.cc
+++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc
@@ -24,7 +24,6 @@
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/sync/glue/bookmark_change_processor.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/test/integration/await_match_status_change_checker.h"
@@ -44,6 +43,7 @@
#include "components/history/core/browser/history_db_task.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_types.h"
+#include "components/sync_bookmarks/bookmark_change_processor.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 490f0d33..c7d7c72 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2857,12 +2857,6 @@
'browser/sync/glue/autofill_data_type_controller.h',
'browser/sync/glue/autofill_profile_data_type_controller.cc',
'browser/sync/glue/autofill_profile_data_type_controller.h',
- 'browser/sync/glue/bookmark_change_processor.cc',
- 'browser/sync/glue/bookmark_change_processor.h',
- 'browser/sync/glue/bookmark_data_type_controller.cc',
- 'browser/sync/glue/bookmark_data_type_controller.h',
- 'browser/sync/glue/bookmark_model_associator.cc',
- 'browser/sync/glue/bookmark_model_associator.h',
'browser/sync/glue/chrome_report_unrecoverable_error.cc',
'browser/sync/glue/chrome_report_unrecoverable_error.h',
'browser/sync/glue/extensions_activity_monitor.cc',
@@ -3146,6 +3140,7 @@
'../components/components.gyp:suggestions',
'../components/components.gyp:signin_core_browser',
'../components/components.gyp:startup_metric_utils',
+ '../components/components.gyp:sync_bookmarks',
'../components/components.gyp:sync_driver',
'../components/components.gyp:translate_core_browser',
'../components/components.gyp:translate_core_common',
diff --git a/components/BUILD.gn b/components/BUILD.gn
index f5d6c8b2..e973c380 100644
--- a/components/BUILD.gn
+++ b/components/BUILD.gn
@@ -30,6 +30,7 @@
"//components/google/core/browser",
"//components/search",
"//components/search_engines",
+ "//components/sync_bookmarks",
"//components/undo",
"//components/strings",
"//components/leveldb_proto",
diff --git a/components/components.gyp b/components/components.gyp
index 4838a70..cda522a 100644
--- a/components/components.gyp
+++ b/components/components.gyp
@@ -77,6 +77,7 @@
'ssl_errors.gypi',
'startup_metric_utils.gypi',
'suggestions.gypi',
+ 'sync_bookmarks.gypi',
'sync_driver.gypi',
'syncable_prefs.gypi',
'toolbar.gypi',
diff --git a/components/sync_bookmarks.gypi b/components/sync_bookmarks.gypi
new file mode 100644
index 0000000..a599993
--- /dev/null
+++ b/components/sync_bookmarks.gypi
@@ -0,0 +1,35 @@
+# 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/sync_bookmarks
+ 'target_name': 'sync_bookmarks',
+ 'type': 'static_library',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../sync/sync.gyp:sync',
+ '../ui/gfx/gfx.gyp:gfx',
+ 'bookmarks_browser',
+ 'favicon_core',
+ 'history_core_browser',
+ 'sync_driver',
+ 'undo_component',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'sources': [
+ # Note: file list duplicated in GN build.
+ 'sync_bookmarks/bookmark_change_processor.cc',
+ 'sync_bookmarks/bookmark_change_processor.h',
+ 'sync_bookmarks/bookmark_data_type_controller.cc',
+ 'sync_bookmarks/bookmark_data_type_controller.h',
+ 'sync_bookmarks/bookmark_model_associator.cc',
+ 'sync_bookmarks/bookmark_model_associator.h',
+ ],
+ },
+ ],
+}
diff --git a/components/sync_bookmarks/BUILD.gn b/components/sync_bookmarks/BUILD.gn
new file mode 100644
index 0000000..faa6123
--- /dev/null
+++ b/components/sync_bookmarks/BUILD.gn
@@ -0,0 +1,27 @@
+# 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("sync_bookmarks") {
+ sources = [
+ "bookmark_change_processor.cc",
+ "bookmark_change_processor.h",
+ "bookmark_data_type_controller.cc",
+ "bookmark_data_type_controller.h",
+ "bookmark_model_associator.cc",
+ "bookmark_model_associator.h",
+ ]
+
+ deps = [
+ "//base",
+ "//components/bookmarks/browser",
+ "//components/favicon/core",
+ "//components/history/core/browser",
+ "//components/sync_driver",
+ "//components/undo",
+ "//sync",
+ "//ui/gfx",
+ ]
+}
diff --git a/components/sync_bookmarks/DEPS b/components/sync_bookmarks/DEPS
new file mode 100644
index 0000000..9b3e0d6
--- /dev/null
+++ b/components/sync_bookmarks/DEPS
@@ -0,0 +1,9 @@
+include_rules = [
+ "+components/bookmarks/browser",
+ "+components/favicon/core",
+ "+components/history/core/browser",
+ "+components/sync_driver",
+ "+components/undo",
+ "+sync",
+ "+ui/gfx",
+]
diff --git a/components/sync_bookmarks/OWNERS b/components/sync_bookmarks/OWNERS
new file mode 100644
index 0000000..3aba9797
--- /dev/null
+++ b/components/sync_bookmarks/OWNERS
@@ -0,0 +1,3 @@
[email protected]
[email protected]
[email protected]
diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/components/sync_bookmarks/bookmark_change_processor.cc
similarity index 99%
rename from chrome/browser/sync/glue/bookmark_change_processor.cc
rename to components/sync_bookmarks/bookmark_change_processor.cc
index c336401..dd10e633 100644
--- a/chrome/browser/sync/glue/bookmark_change_processor.cc
+++ b/components/sync_bookmarks/bookmark_change_processor.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/sync/glue/bookmark_change_processor.h"
+#include "components/sync_bookmarks/bookmark_change_processor.h"
#include <map>
#include <stack>
diff --git a/chrome/browser/sync/glue/bookmark_change_processor.h b/components/sync_bookmarks/bookmark_change_processor.h
similarity index 97%
rename from chrome/browser/sync/glue/bookmark_change_processor.h
rename to components/sync_bookmarks/bookmark_change_processor.h
index 0310218..b8d25fe 100644
--- a/chrome/browser/sync/glue/bookmark_change_processor.h
+++ b/components/sync_bookmarks/bookmark_change_processor.h
@@ -2,16 +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_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_
-#define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_
+#ifndef COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_
+#define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_
#include <vector>
#include "base/compiler_specific.h"
#include "base/threading/thread_checker.h"
-#include "chrome/browser/sync/glue/bookmark_model_associator.h"
#include "components/bookmarks/browser/bookmark_model_observer.h"
#include "components/bookmarks/browser/bookmark_node.h"
+#include "components/sync_bookmarks/bookmark_model_associator.h"
#include "components/sync_driver/change_processor.h"
#include "components/sync_driver/data_type_error_handler.h"
@@ -254,4 +254,4 @@
} // namespace browser_sync
-#endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_
+#endif // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_
diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller.cc b/components/sync_bookmarks/bookmark_data_type_controller.cc
similarity index 97%
rename from chrome/browser/sync/glue/bookmark_data_type_controller.cc
rename to components/sync_bookmarks/bookmark_data_type_controller.cc
index 99a8073..85e71fa 100644
--- a/chrome/browser/sync/glue/bookmark_data_type_controller.cc
+++ b/components/sync_bookmarks/bookmark_data_type_controller.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/sync/glue/bookmark_data_type_controller.h"
+#include "components/sync_bookmarks/bookmark_data_type_controller.h"
#include "base/metrics/histogram.h"
#include "components/bookmarks/browser/bookmark_model.h"
diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller.h b/components/sync_bookmarks/bookmark_data_type_controller.h
similarity index 90%
rename from chrome/browser/sync/glue/bookmark_data_type_controller.h
rename to components/sync_bookmarks/bookmark_data_type_controller.h
index 30d8cde..b7cb7b3b 100644
--- a/chrome/browser/sync/glue/bookmark_data_type_controller.h
+++ b/components/sync_bookmarks/bookmark_data_type_controller.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_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__
-#define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__
+#ifndef COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_DATA_TYPE_CONTROLLER_H__
+#define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_DATA_TYPE_CONTROLLER_H__
#include <string>
@@ -61,4 +61,4 @@
} // namespace browser_sync
-#endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__
+#endif // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_DATA_TYPE_CONTROLLER_H__
diff --git a/chrome/browser/sync/glue/bookmark_model_associator.cc b/components/sync_bookmarks/bookmark_model_associator.cc
similarity index 99%
rename from chrome/browser/sync/glue/bookmark_model_associator.cc
rename to components/sync_bookmarks/bookmark_model_associator.cc
index 44dcaee4..27b5824a 100644
--- a/chrome/browser/sync/glue/bookmark_model_associator.cc
+++ b/components/sync_bookmarks/bookmark_model_associator.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/sync/glue/bookmark_model_associator.h"
+#include "components/sync_bookmarks/bookmark_model_associator.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -17,9 +17,9 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/sync/glue/bookmark_change_processor.h"
#include "components/bookmarks/browser/bookmark_client.h"
#include "components/bookmarks/browser/bookmark_model.h"
+#include "components/sync_bookmarks/bookmark_change_processor.h"
#include "components/sync_driver/sync_client.h"
#include "components/undo/bookmark_undo_service.h"
#include "components/undo/bookmark_undo_utils.h"
diff --git a/chrome/browser/sync/glue/bookmark_model_associator.h b/components/sync_bookmarks/bookmark_model_associator.h
similarity index 98%
rename from chrome/browser/sync/glue/bookmark_model_associator.h
rename to components/sync_bookmarks/bookmark_model_associator.h
index 3cf802f..9075a1e 100644
--- a/chrome/browser/sync/glue/bookmark_model_associator.h
+++ b/components/sync_bookmarks/bookmark_model_associator.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_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
-#define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
+#ifndef COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_
+#define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_
#include <map>
#include <set>
@@ -325,4 +325,4 @@
} // namespace browser_sync
-#endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
+#endif // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_