Commit a8f61337 authored by tby's avatar tby Committed by Commit Bot

[Suggested files] Enable drive zero state provider

This CL replaces the DriveQuickAccessProvider with the new
DriveZeroStateProvider, and adds a deprecation todo to the former.

If there are any issues with the new provider, this one CL can be
reverted to disable the entire feature.

Bug: 1034842
Change-Id: I6a82a948aa41301918d8a80368bfb5cda2303a11
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2437996Reviewed-by: default avatarRachel Wong <wrong@chromium.org>
Commit-Queue: Tony Yeoman <tby@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812497}
parent 7d930a90
......@@ -25,6 +25,10 @@ class SearchController;
// DriveQuickAccessProvider dispatches queries to extensions and fetches the
// results from them via chrome.launcherSearchProvider API.
//
// TODO(crbug.com/1034842): This is deprecated in favour of
// DriveZeroStateProvider. This class and related results classes can be
// deleted.
class DriveQuickAccessProvider : public SearchProvider,
public drive::DriveIntegrationServiceObserver {
public:
......
......@@ -63,7 +63,7 @@ constexpr size_t kMaxLauncherSearchResults = 4;
// We need twice as many ZeroState and Drive file results as we need
// duplicates of these results for the suggestion chips.
constexpr size_t kMaxZeroStateFileResults = 20;
constexpr size_t kMaxDriveQuickAccessResults = 10;
constexpr size_t kMaxDriveZeroStateResults = 10;
constexpr size_t kMaxAppReinstallSearchResults = 1;
// We show up to 6 Play Store results. However, part of Play Store results may
// be filtered out because they may correspond to already installed Web apps. So
......@@ -86,13 +86,6 @@ constexpr size_t kMaxAssistantTextResults = 1;
// TODO(wutao): Need UX spec.
constexpr size_t kMaxSettingsShortcutResults = 6;
// A flag to easily replace the old Drive zero-state provider with the new one
// during development.
//
// TODO(crbug.com/1034842): Once implementation is finished, remove this flag
// and always use the new provider.
constexpr bool kUseNewDriveProvider = false;
} // namespace
std::unique_ptr<SearchController> CreateSearchController(
......@@ -200,21 +193,14 @@ std::unique_ptr<SearchController> CreateSearchController(
controller->AddGroup(kMaxZeroStateFileResults);
controller->AddProvider(zero_state_files_group_id,
std::make_unique<ZeroStateFileProvider>(profile));
size_t drive_quick_access_group_id =
controller->AddGroup(kMaxDriveQuickAccessResults);
if (kUseNewDriveProvider) {
controller->AddProvider(
drive_quick_access_group_id,
std::make_unique<DriveZeroStateProvider>(
profile, controller.get(),
content::BrowserContext::GetDefaultStoragePartition(profile)
->GetURLLoaderFactoryForBrowserProcess()));
} else {
controller->AddProvider(drive_quick_access_group_id,
std::make_unique<DriveQuickAccessProvider>(
profile, controller.get()));
}
size_t drive_zero_state_group_id =
controller->AddGroup(kMaxDriveZeroStateResults);
controller->AddProvider(
drive_zero_state_group_id,
std::make_unique<DriveZeroStateProvider>(
profile, controller.get(),
content::BrowserContext::GetDefaultStoragePartition(profile)
->GetURLLoaderFactoryForBrowserProcess()));
}
if (app_list_features::IsLauncherSettingsSearchEnabled()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment