Commit 7d5f24ac authored by tby's avatar tby Committed by Commit Bot

[Suggested files] Tweak request, remove dependency.

 1. Adds a 'type_detail_fields' into the request json which makes the
    response as small as possible.

 2. Removes the FileTasksNotifier pointer from the provider, which we
    don't need anymore.

Bug: 1034842
Change-Id: I8c663c10543e1547aa3379cf6acce173e653a71e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438089Reviewed-by: default avatarRachel Wong <wrong@chromium.org>
Commit-Queue: Tony Yeoman <tby@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811927}
parent c14fae86
......@@ -24,6 +24,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace app_list {
namespace {
......@@ -50,8 +51,6 @@ DriveZeroStateProvider::DriveZeroStateProvider(
: profile_(profile),
drive_service_(
drive::DriveIntegrationServiceFactory::GetForProfile(profile)),
file_tasks_notifier_(
file_manager::file_tasks::FileTasksNotifier::GetForProfile(profile)),
item_suggest_cache_(profile, std::move(url_loader_factory)),
suggested_files_enabled_(app_list_features::IsSuggestedFilesEnabled()) {
DCHECK(profile_);
......@@ -109,9 +108,8 @@ void DriveZeroStateProvider::Start(const base::string16& query) {
// Exit in three cases:
// - this search has a non-empty query, we only handle zero-state.
// - drive fs isn't mounted, as we launch results via drive fs.
// - the |file_tasks_notifier_| is unavailable, as we stat files using it.
const bool drive_fs_mounted = drive_service_ && drive_service_->IsMounted();
if (!query.empty() || !drive_fs_mounted || !file_tasks_notifier_) {
if (!query.empty() || !drive_fs_mounted) {
// TODO(crbug.com/1034842): Log error metrics.
return;
}
......
......@@ -14,7 +14,6 @@
#include "base/strings/string16.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/file_manager/file_tasks_notifier.h"
#include "chrome/browser/ui/app_list/search/files/file_result.h"
#include "chrome/browser/ui/app_list/search/files/item_suggest_cache.h"
#include "chrome/browser/ui/app_list/search/search_provider.h"
......@@ -57,7 +56,6 @@ class DriveZeroStateProvider : public SearchProvider,
Profile* const profile_;
drive::DriveIntegrationService* const drive_service_;
file_manager::file_tasks::FileTasksNotifier* const file_tasks_notifier_;
ItemSuggestCache item_suggest_cache_;
......
......@@ -69,7 +69,8 @@ constexpr char kRequestBody[] = R"({
'platform_type': 'CHROME_OS',
'scenario_type': 'CHROME_OS_ZSS_FILES'
},
'max_suggestions': 10
'max_suggestions': 10,
'type_detail_fields': 'drive_item.title,justification.display_text'
})";
bool IsDisabledByPolicy(const Profile* profile) {
......
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