Skip to content

Commit

Permalink
[iOS] Move ios/c/b/bookmarks to model subfolder
Browse files Browse the repository at this point in the history
To simplify the folder hierarchy on iOS and have a clearer layer
separation, all the files in ios/c/b/<foo>/ will be moved to
ios/c/b/<foo>/model/ to showcase that they are model files.

Bug: 1319852
Change-Id: Id8c7887063f93fe4c7bee047d71c3398f8d14db1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4798429
Reviewed-by: Jérôme Lebel <jlebel@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1187095}
  • Loading branch information
Gauthier Ambard authored and Chromium LUCI CQ committed Aug 23, 2023
1 parent e106ee0 commit caf0394
Show file tree
Hide file tree
Showing 134 changed files with 258 additions and 247 deletions.
2 changes: 1 addition & 1 deletion ios/chrome/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ source_set("app_internal") {
"//ios/chrome/app/startup:startup_basic",
"//ios/chrome/app/strings",
"//ios/chrome/browser/accessibility",
"//ios/chrome/browser/bookmarks",
"//ios/chrome/browser/bookmarks/model",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/browsing_data",
"//ios/chrome/browser/commerce/push_notification",
Expand Down
4 changes: 2 additions & 2 deletions ios/chrome/app/spotlight/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ source_set("spotlight") {
"//components/search_engines",
"//ios/chrome/app",
"//ios/chrome/app/strings",
"//ios/chrome/browser/bookmarks",
"//ios/chrome/browser/bookmarks/model",
"//ios/chrome/browser/favicon",
"//ios/chrome/browser/history",
"//ios/chrome/browser/reading_list",
Expand Down Expand Up @@ -87,7 +87,7 @@ source_set("unit_tests") {
"//components/favicon/core/test:test_support",
"//components/favicon_base",
"//components/reading_list/core",
"//ios/chrome/browser/bookmarks",
"//ios/chrome/browser/bookmarks/model",
"//ios/chrome/browser/main:main",
"//ios/chrome/browser/reading_list",
"//ios/chrome/browser/reading_list:test_support",
Expand Down
2 changes: 1 addition & 1 deletion ios/chrome/app/spotlight/bookmarks_spotlight_manager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#import "ios/chrome/app/spotlight/searchable_item_factory.h"
#import "ios/chrome/app/spotlight/spotlight_interface.h"
#import "ios/chrome/app/spotlight/spotlight_logger.h"
#import "ios/chrome/browser/bookmarks/local_or_syncable_bookmark_model_factory.h"
#import "ios/chrome/browser/bookmarks/model/local_or_syncable_bookmark_model_factory.h"
#import "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h"

namespace {
Expand Down
2 changes: 1 addition & 1 deletion ios/chrome/app/spotlight/topsites_spotlight_manager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#import "ios/chrome/app/spotlight/searchable_item_factory.h"
#import "ios/chrome/app/spotlight/spotlight_interface.h"
#import "ios/chrome/app/spotlight/spotlight_logger.h"
#import "ios/chrome/browser/bookmarks/local_or_syncable_bookmark_model_factory.h"
#import "ios/chrome/browser/bookmarks/model/local_or_syncable_bookmark_model_factory.h"
#import "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h"
#import "ios/chrome/browser/history/top_sites_factory.h"
#import "ios/chrome/browser/sync/sync_observer_bridge.h"
Expand Down
2 changes: 1 addition & 1 deletion ios/chrome/browser/autocomplete/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ source_set("autocomplete") {
"//components/strings",
"//components/sync",
"//components/unified_consent",
"//ios/chrome/browser/bookmarks",
"//ios/chrome/browser/bookmarks/model",
"//ios/chrome/browser/history",
"//ios/chrome/browser/search_engines",
"//ios/chrome/browser/shared/model/application_context",
Expand Down
2 changes: 1 addition & 1 deletion ios/chrome/browser/autocomplete/DEPS
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include_rules = [
"+components/omnibox/resources",
"+ios/chrome/browser/search_engines",
"+ios/chrome/browser/bookmarks",
"+ios/chrome/browser/bookmarks/model",
"+ios/chrome/browser/history",
"+ios/chrome/browser/search_engines",
"+ios/chrome/browser/signin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#import "ios/chrome/browser/autocomplete/shortcuts_backend_factory.h"
#import "ios/chrome/browser/autocomplete/tab_matcher_impl.h"
#import "ios/chrome/browser/autocomplete/zero_suggest_cache_service_factory.h"
#import "ios/chrome/browser/bookmarks/account_bookmark_model_factory.h"
#import "ios/chrome/browser/bookmarks/local_or_syncable_bookmark_model_factory.h"
#import "ios/chrome/browser/bookmarks/model/account_bookmark_model_factory.h"
#import "ios/chrome/browser/bookmarks/model/local_or_syncable_bookmark_model_factory.h"
#import "ios/chrome/browser/history/history_service_factory.h"
#import "ios/chrome/browser/history/top_sites_factory.h"
#import "ios/chrome/browser/search_engines/template_url_service_factory.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "components/keyed_service/core/service_access_type.h"
#include "components/keyed_service/ios/browser_state_dependency_manager.h"
#include "components/omnibox/browser/in_memory_url_index.h"
#include "ios/chrome/browser/bookmarks/local_or_syncable_bookmark_model_factory.h"
#include "ios/chrome/browser/bookmarks/model/local_or_syncable_bookmark_model_factory.h"
#include "ios/chrome/browser/history/history_service_factory.h"
#include "ios/chrome/browser/search_engines/template_url_service_factory.h"
#include "ios/chrome/browser/shared/model/browser_state/browser_state_otr_helper.h"
Expand Down
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.

source_set("bookmarks") {
source_set("model") {
sources = [
"account_bookmark_model_factory.cc",
"account_bookmark_model_factory.h",
Expand Down Expand Up @@ -42,14 +42,14 @@ source_set("bookmarks") {
"//ios/chrome/browser/signin:system_identity_manager",
"//ios/web",
]
public_deps = [ ":bookmarks_utils" ]
public_deps = [ ":model_utils" ]
allow_circular_includes_from = [
"//ios/chrome/browser/history",
":bookmarks_utils",
":model_utils",
]
}

source_set("bookmarks_utils") {
source_set("model_utils") {
sources = [
"bookmark_remover_helper.cc",
"bookmark_remover_helper.h",
Expand All @@ -76,7 +76,7 @@ source_set("test_support") {
"//base/test:test_support",
"//components/bookmarks/browser",
"//components/bookmarks/test",
"//ios/chrome/browser/bookmarks",
"//ios/chrome/browser/bookmarks/model",
"//ios/chrome/browser/shared/model/browser/test:test_support",
"//ios/chrome/browser/shared/model/browser_state:test_support",
"//ios/chrome/browser/signin",
Expand All @@ -93,7 +93,7 @@ source_set("unit_tests") {
"bookmarks_utils_unittest.mm",
]
deps = [
":bookmarks",
":model",
":test_support",
"//base",
"//base/test:test_support",
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 "ios/chrome/browser/bookmarks/account_bookmark_model_factory.h"
#include "ios/chrome/browser/bookmarks/model/account_bookmark_model_factory.h"

#include <utility>
#include "base/files/file_path.h"
Expand All @@ -15,11 +15,11 @@
#include "components/prefs/pref_service.h"
#include "components/sync/base/features.h"
#include "components/undo/bookmark_undo_service.h"
#include "ios/chrome/browser/bookmarks/account_bookmark_sync_service_factory.h"
#include "ios/chrome/browser/bookmarks/bookmark_client_impl.h"
#include "ios/chrome/browser/bookmarks/bookmark_undo_service_factory.h"
#include "ios/chrome/browser/bookmarks/local_or_syncable_bookmark_model_factory.h"
#include "ios/chrome/browser/bookmarks/local_or_syncable_bookmark_sync_service_factory.h"
#include "ios/chrome/browser/bookmarks/model/account_bookmark_sync_service_factory.h"
#include "ios/chrome/browser/bookmarks/model/bookmark_client_impl.h"
#include "ios/chrome/browser/bookmarks/model/bookmark_undo_service_factory.h"
#include "ios/chrome/browser/bookmarks/model/local_or_syncable_bookmark_model_factory.h"
#include "ios/chrome/browser/bookmarks/model/local_or_syncable_bookmark_sync_service_factory.h"
#include "ios/chrome/browser/history/history_service_factory.h"
#include "ios/chrome/browser/shared/model/browser_state/browser_state_otr_helper.h"
#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h"
Expand Down
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 IOS_CHROME_BROWSER_BOOKMARKS_ACCOUNT_BOOKMARK_MODEL_FACTORY_H_
#define IOS_CHROME_BROWSER_BOOKMARKS_ACCOUNT_BOOKMARK_MODEL_FACTORY_H_
#ifndef IOS_CHROME_BROWSER_BOOKMARKS_MODEL_ACCOUNT_BOOKMARK_MODEL_FACTORY_H_
#define IOS_CHROME_BROWSER_BOOKMARKS_MODEL_ACCOUNT_BOOKMARK_MODEL_FACTORY_H_

#include <memory>

Expand Down Expand Up @@ -45,4 +45,4 @@ class AccountBookmarkModelFactory : public BrowserStateKeyedServiceFactory {

} // namespace ios

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

#include "ios/chrome/browser/bookmarks/account_bookmark_sync_service_factory.h"
#include "ios/chrome/browser/bookmarks/model/account_bookmark_sync_service_factory.h"

#include "base/no_destructor.h"
#include "components/bookmarks/common/bookmark_features.h"
#include "components/keyed_service/ios/browser_state_dependency_manager.h"
#include "components/sync/base/features.h"
#include "components/sync/model/wipe_model_upon_sync_disabled_behavior.h"
#include "components/sync_bookmarks/bookmark_sync_service.h"
#include "ios/chrome/browser/bookmarks/bookmark_undo_service_factory.h"
#include "ios/chrome/browser/bookmarks/model/bookmark_undo_service_factory.h"
#include "ios/chrome/browser/shared/model/browser_state/browser_state_otr_helper.h"
#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h"

Expand Down
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 IOS_CHROME_BROWSER_BOOKMARKS_ACCOUNT_BOOKMARK_SYNC_SERVICE_FACTORY_H_
#define IOS_CHROME_BROWSER_BOOKMARKS_ACCOUNT_BOOKMARK_SYNC_SERVICE_FACTORY_H_
#ifndef IOS_CHROME_BROWSER_BOOKMARKS_MODEL_ACCOUNT_BOOKMARK_SYNC_SERVICE_FACTORY_H_
#define IOS_CHROME_BROWSER_BOOKMARKS_MODEL_ACCOUNT_BOOKMARK_SYNC_SERVICE_FACTORY_H_

#include <memory>

Expand Down Expand Up @@ -46,4 +46,4 @@ class AccountBookmarkSyncServiceFactory

} // namespace ios

#endif // IOS_CHROME_BROWSER_BOOKMARKS_ACCOUNT_BOOKMARK_SYNC_SERVICE_FACTORY_H_
#endif // IOS_CHROME_BROWSER_BOOKMARKS_MODEL_ACCOUNT_BOOKMARK_SYNC_SERVICE_FACTORY_H_
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 "ios/chrome/browser/bookmarks/bookmark_client_impl.h"
#include "ios/chrome/browser/bookmarks/model/bookmark_client_impl.h"

#include <utility>

Expand Down Expand Up @@ -35,8 +35,9 @@ BookmarkClientImpl::BookmarkClientImpl(
BookmarkClientImpl::~BookmarkClientImpl() {}

void BookmarkClientImpl::Init(bookmarks::BookmarkModel* model) {
if (managed_bookmark_service_)
if (managed_bookmark_service_) {
managed_bookmark_service_->BookmarkModelCreated(model);
}
model_ = model;
}

Expand Down Expand Up @@ -69,8 +70,9 @@ void BookmarkClientImpl::GetTypedCountForUrls(
int typed_count = 0;
history::URLRow url_row;
const GURL* url = url_typed_count_pair.first;
if (url_db && url && url_db->GetRowForURL(*url, &url_row))
if (url_db && url && url_db->GetRowForURL(*url, &url_row)) {
typed_count = url_row.typed_count();
}

url_typed_count_pair.second = typed_count;
}
Expand All @@ -83,8 +85,9 @@ bool BookmarkClientImpl::IsPermanentNodeVisibleWhenEmpty(

bookmarks::LoadManagedNodeCallback
BookmarkClientImpl::GetLoadManagedNodeCallback() {
if (managed_bookmark_service_)
if (managed_bookmark_service_) {
return managed_bookmark_service_->GetLoadManagedNodeCallback();
}
return bookmarks::LoadManagedNodeCallback();
}

Expand All @@ -103,21 +106,24 @@ BookmarkClientImpl::GetStorageStateForUma() {

bool BookmarkClientImpl::CanSetPermanentNodeTitle(
const bookmarks::BookmarkNode* permanent_node) {
if (managed_bookmark_service_)
if (managed_bookmark_service_) {
return managed_bookmark_service_->CanSetPermanentNodeTitle(permanent_node);
}
return true;
}

bool BookmarkClientImpl::CanSyncNode(const bookmarks::BookmarkNode* node) {
if (managed_bookmark_service_)
if (managed_bookmark_service_) {
return managed_bookmark_service_->CanSyncNode(node);
}
return true;
}

bool BookmarkClientImpl::CanBeEditedByUser(
const bookmarks::BookmarkNode* node) {
if (managed_bookmark_service_)
if (managed_bookmark_service_) {
return managed_bookmark_service_->CanBeEditedByUser(node);
}
return true;
}

Expand Down
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 IOS_CHROME_BROWSER_BOOKMARKS_BOOKMARK_CLIENT_IMPL_H_
#define IOS_CHROME_BROWSER_BOOKMARKS_BOOKMARK_CLIENT_IMPL_H_
#ifndef IOS_CHROME_BROWSER_BOOKMARKS_MODEL_BOOKMARK_CLIENT_IMPL_H_
#define IOS_CHROME_BROWSER_BOOKMARKS_MODEL_BOOKMARK_CLIENT_IMPL_H_

#include <set>
#include <string>
Expand Down Expand Up @@ -88,4 +88,4 @@ class BookmarkClientImpl : public bookmarks::BookmarkClient {
raw_ptr<bookmarks::BookmarkModel> model_ = nullptr;
};

#endif // IOS_CHROME_BROWSER_BOOKMARKS_BOOKMARK_CLIENT_IMPL_H_
#endif // IOS_CHROME_BROWSER_BOOKMARKS_MODEL_BOOKMARK_CLIENT_IMPL_H_
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 IOS_CHROME_BROWSER_BOOKMARKS_BOOKMARK_IOS_UNIT_TEST_SUPPORT_H_
#define IOS_CHROME_BROWSER_BOOKMARKS_BOOKMARK_IOS_UNIT_TEST_SUPPORT_H_
#ifndef IOS_CHROME_BROWSER_BOOKMARKS_MODEL_BOOKMARK_IOS_UNIT_TEST_SUPPORT_H_
#define IOS_CHROME_BROWSER_BOOKMARKS_MODEL_BOOKMARK_IOS_UNIT_TEST_SUPPORT_H_

#import <Foundation/Foundation.h>

Expand Down Expand Up @@ -60,4 +60,4 @@ class BookmarkIOSUnitTestSupport : public PlatformTest {
bookmarks::ManagedBookmarkService* managed_bookmark_service_;
};

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

#import "ios/chrome/browser/bookmarks/bookmark_ios_unit_test_support.h"
#import "ios/chrome/browser/bookmarks/model/bookmark_ios_unit_test_support.h"
#import <memory>

#import "base/strings/sys_string_conversions.h"
#import "components/bookmarks/browser/bookmark_model.h"
#import "components/bookmarks/common/bookmark_features.h"
#import "components/bookmarks/common/bookmark_metrics.h"
#import "components/bookmarks/test/bookmark_test_helpers.h"
#import "ios/chrome/browser/bookmarks/account_bookmark_model_factory.h"
#import "ios/chrome/browser/bookmarks/local_or_syncable_bookmark_model_factory.h"
#import "ios/chrome/browser/bookmarks/managed_bookmark_service_factory.h"
#import "ios/chrome/browser/bookmarks/model/account_bookmark_model_factory.h"
#import "ios/chrome/browser/bookmarks/model/local_or_syncable_bookmark_model_factory.h"
#import "ios/chrome/browser/bookmarks/model/managed_bookmark_service_factory.h"
#import "ios/chrome/browser/shared/model/browser/test/test_browser.h"
#import "ios/chrome/browser/shared/model/browser_state/test_chrome_browser_state.h"
#import "ios/chrome/browser/signin/authentication_service_factory.h"
Expand Down
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 IOS_CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_BRIDGE_OBSERVER_H_
#define IOS_CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_BRIDGE_OBSERVER_H_
#ifndef IOS_CHROME_BROWSER_BOOKMARKS_MODEL_BOOKMARK_MODEL_BRIDGE_OBSERVER_H_
#define IOS_CHROME_BROWSER_BOOKMARKS_MODEL_BOOKMARK_MODEL_BRIDGE_OBSERVER_H_

#import <Foundation/Foundation.h>

Expand Down Expand Up @@ -94,4 +94,4 @@ class BookmarkModelBridge : public bookmarks::BookmarkModelObserver {
model_observation_{this};
};

#endif // IOS_CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_BRIDGE_OBSERVER_H_
#endif // IOS_CHROME_BROWSER_BOOKMARKS_MODEL_BOOKMARK_MODEL_BRIDGE_OBSERVER_H_
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.

#import "ios/chrome/browser/bookmarks/bookmark_model_bridge_observer.h"
#import "ios/chrome/browser/bookmarks/model/bookmark_model_bridge_observer.h"

#import <Foundation/Foundation.h>

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

#import "ios/chrome/browser/bookmarks/bookmark_model_bridge_observer.h"
#import "ios/chrome/browser/bookmarks/model/bookmark_model_bridge_observer.h"

#import <memory>

#import "components/bookmarks/browser/bookmark_model.h"
#import "components/bookmarks/common/bookmark_metrics.h"
#import "ios/chrome/browser/bookmarks/bookmark_ios_unit_test_support.h"
#import "ios/chrome/browser/bookmarks/model/bookmark_ios_unit_test_support.h"

@class TestBookmarkModelBridgeObserver;

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

#include "ios/chrome/browser/bookmarks/bookmark_remover_helper.h"
#include "ios/chrome/browser/bookmarks/model/bookmark_remover_helper.h"

#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/notreached.h"
#include "base/task/sequenced_task_runner.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "ios/chrome/browser/bookmarks/bookmarks_utils.h"
#include "ios/chrome/browser/bookmarks/local_or_syncable_bookmark_model_factory.h"
#include "ios/chrome/browser/bookmarks/model/bookmarks_utils.h"
#include "ios/chrome/browser/bookmarks/model/local_or_syncable_bookmark_model_factory.h"
#include "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h"

BookmarkRemoverHelper::BookmarkRemoverHelper(ChromeBrowserState* browser_state)
Expand Down

0 comments on commit caf0394

Please sign in to comment.