Commit 888c4fe7 authored by Toni Barzic's avatar Toni Barzic Committed by Chromium LUCI CQ

Remove unused methods from AppListControllerDelegate

BUG=None

Change-Id: I3c4a9e632dfa932c46fce8f9c4e3d8ed3fd18c97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2556456Reviewed-by: default avatarNancy Wang <nancylingwang@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832714}
parent 01c8c8eb
...@@ -433,16 +433,6 @@ int64_t AppListClientImpl::GetAppListDisplayId() { ...@@ -433,16 +433,6 @@ int64_t AppListClientImpl::GetAppListDisplayId() {
return display_id_; return display_id_;
} }
void AppListClientImpl::GetAppInfoDialogBounds(
GetAppInfoDialogBoundsCallback callback) {
if (!app_list_controller_) {
LOG(ERROR) << "app_list_controller_ is null";
std::move(callback).Run(gfx::Rect());
return;
}
app_list_controller_->GetAppInfoDialogBounds(std::move(callback));
}
bool AppListClientImpl::IsAppPinned(const std::string& app_id) { bool AppListClientImpl::IsAppPinned(const std::string& app_id) {
return ChromeLauncherController::instance()->IsAppPinned(app_id); return ChromeLauncherController::instance()->IsAppPinned(app_id);
} }
...@@ -478,38 +468,6 @@ void AppListClientImpl::OpenURL(Profile* profile, ...@@ -478,38 +468,6 @@ void AppListClientImpl::OpenURL(Profile* profile,
Navigate(&params); Navigate(&params);
} }
void AppListClientImpl::ActivateApp(Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags) {
// Platform apps treat activations as a launch. The app can decide whether to
// show a new window or focus an existing window as it sees fit.
if (extension->is_platform_app()) {
LaunchApp(profile, extension, source, event_flags, GetAppListDisplayId());
return;
}
ChromeLauncherController::instance()->ActivateApp(
extension->id(), AppListSourceToLaunchSource(source), event_flags,
GetAppListDisplayId());
if (!IsTabletMode())
DismissView();
}
void AppListClientImpl::LaunchApp(Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags,
int64_t display_id) {
ChromeLauncherController::instance()->LaunchApp(
ash::ShelfID(extension->id()), AppListSourceToLaunchSource(source),
event_flags, display_id);
if (!IsTabletMode())
DismissView();
}
void AppListClientImpl::NotifySearchResultsForLogging( void AppListClientImpl::NotifySearchResultsForLogging(
const base::string16& trimmed_query, const base::string16& trimmed_query,
const ash::SearchResultIdWithPositionIndices& results, const ash::SearchResultIdWithPositionIndices& results,
...@@ -523,15 +481,3 @@ void AppListClientImpl::NotifySearchResultsForLogging( ...@@ -523,15 +481,3 @@ void AppListClientImpl::NotifySearchResultsForLogging(
ash::AppListNotifier* AppListClientImpl::GetNotifier() { ash::AppListNotifier* AppListClientImpl::GetNotifier() {
return app_list_notifier_.get(); return app_list_notifier_.get();
} }
ash::ShelfLaunchSource AppListClientImpl::AppListSourceToLaunchSource(
AppListSource source) {
switch (source) {
case LAUNCH_FROM_APP_LIST:
return ash::LAUNCH_FROM_APP_LIST;
case LAUNCH_FROM_APP_LIST_SEARCH:
return ash::LAUNCH_FROM_APP_LIST_SEARCH;
default:
return ash::LAUNCH_FROM_UNKNOWN;
}
}
...@@ -96,7 +96,6 @@ class AppListClientImpl ...@@ -96,7 +96,6 @@ class AppListClientImpl
void DismissView() override; void DismissView() override;
aura::Window* GetAppListWindow() override; aura::Window* GetAppListWindow() override;
int64_t GetAppListDisplayId() override; int64_t GetAppListDisplayId() override;
void GetAppInfoDialogBounds(GetAppInfoDialogBoundsCallback callback) override;
bool IsAppPinned(const std::string& app_id) override; bool IsAppPinned(const std::string& app_id) override;
bool IsAppOpen(const std::string& app_id) const override; bool IsAppOpen(const std::string& app_id) const override;
void PinApp(const std::string& app_id) override; void PinApp(const std::string& app_id) override;
...@@ -107,15 +106,6 @@ class AppListClientImpl ...@@ -107,15 +106,6 @@ class AppListClientImpl
const GURL& url, const GURL& url,
ui::PageTransition transition, ui::PageTransition transition,
WindowOpenDisposition disposition) override; WindowOpenDisposition disposition) override;
void ActivateApp(Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags) override;
void LaunchApp(Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags,
int64_t display_id) override;
// Associates this client with the current active user, called when this // Associates this client with the current active user, called when this
// client is accessed or active user is changed. // client is accessed or active user is changed.
...@@ -150,8 +140,6 @@ class AppListClientImpl ...@@ -150,8 +140,6 @@ class AppListClientImpl
// Updates the speech webview and start page for the current |profile_|. // Updates the speech webview and start page for the current |profile_|.
void SetUpSearchUI(); void SetUpSearchUI();
ash::ShelfLaunchSource AppListSourceToLaunchSource(AppListSource source);
// The current display id showing the app list. // The current display id showing the app list.
int64_t display_id_ = display::kInvalidDisplayId; int64_t display_id_ = display::kInvalidDisplayId;
......
...@@ -56,32 +56,6 @@ AppListControllerDelegate::AppListControllerDelegate() {} ...@@ -56,32 +56,6 @@ AppListControllerDelegate::AppListControllerDelegate() {}
AppListControllerDelegate::~AppListControllerDelegate() {} AppListControllerDelegate::~AppListControllerDelegate() {}
void AppListControllerDelegate::GetAppInfoDialogBounds(
GetAppInfoDialogBoundsCallback callback) {
std::move(callback).Run(gfx::Rect());
}
std::string AppListControllerDelegate::AppListSourceToString(
AppListSource source) {
switch (source) {
case LAUNCH_FROM_APP_LIST:
return extension_urls::kLaunchSourceAppList;
case LAUNCH_FROM_APP_LIST_SEARCH:
return extension_urls::kLaunchSourceAppListSearch;
default:
return std::string();
}
}
bool AppListControllerDelegate::UninstallAllowed(Profile* profile,
const std::string& app_id) {
const extensions::Extension* extension = GetExtension(profile, app_id);
const extensions::ManagementPolicy* policy =
extensions::ExtensionSystem::Get(profile)->management_policy();
return extension && policy->UserMayModifySettings(extension, nullptr) &&
!policy->MustRemainInstalled(extension, nullptr);
}
void AppListControllerDelegate::DoShowAppInfoFlow(Profile* profile, void AppListControllerDelegate::DoShowAppInfoFlow(Profile* profile,
const std::string& app_id) { const std::string& app_id) {
apps::AppServiceProxy* proxy = apps::AppServiceProxy* proxy =
...@@ -109,38 +83,6 @@ void AppListControllerDelegate::UninstallApp(Profile* profile, ...@@ -109,38 +83,6 @@ void AppListControllerDelegate::UninstallApp(Profile* profile,
proxy->Uninstall(app_id, GetAppListWindow()); proxy->Uninstall(app_id, GetAppListWindow());
} }
bool AppListControllerDelegate::IsAppFromWebStore(Profile* profile,
const std::string& app_id) {
const extensions::Extension* extension = GetExtension(profile, app_id);
return extension && extension->from_webstore();
}
void AppListControllerDelegate::ShowAppInWebStore(Profile* profile,
const std::string& app_id,
bool is_search_result) {
const extensions::Extension* extension = GetExtension(profile, app_id);
if (!extension)
return;
const GURL url = extensions::ManifestURL::GetDetailsURL(extension);
DCHECK_NE(url, GURL::EmptyGURL());
const std::string source = AppListSourceToString(
is_search_result ? AppListControllerDelegate::LAUNCH_FROM_APP_LIST_SEARCH
: AppListControllerDelegate::LAUNCH_FROM_APP_LIST);
OpenURL(profile,
net::AppendQueryParameter(url, extension_urls::kWebstoreSourceField,
source),
ui::PAGE_TRANSITION_LINK, WindowOpenDisposition::CURRENT_TAB);
}
bool AppListControllerDelegate::HasOptionsPage(Profile* profile,
const std::string& app_id) {
const extensions::Extension* extension = GetExtension(profile, app_id);
return extensions::util::IsAppLaunchableWithoutEnabling(app_id, profile) &&
extension && extensions::OptionsPageInfo::HasOptionsPage(extension);
}
void AppListControllerDelegate::ShowOptionsPage(Profile* profile, void AppListControllerDelegate::ShowOptionsPage(Profile* profile,
const std::string& app_id) { const std::string& app_id) {
const extensions::Extension* extension = GetExtension(profile, app_id); const extensions::Extension* extension = GetExtension(profile, app_id);
...@@ -165,28 +107,6 @@ void AppListControllerDelegate::SetExtensionLaunchType( ...@@ -165,28 +107,6 @@ void AppListControllerDelegate::SetExtensionLaunchType(
extensions::SetLaunchType(profile, extension_id, launch_type); extensions::SetLaunchType(profile, extension_id, launch_type);
} }
bool AppListControllerDelegate::IsExtensionInstalled(
Profile* profile,
const std::string& app_id) {
return !!GetExtension(profile, app_id);
}
extensions::InstallTracker* AppListControllerDelegate::GetInstallTrackerFor(
Profile* profile) {
if (extensions::ExtensionSystem::Get(profile)->extension_service())
return extensions::InstallTrackerFactory::GetForBrowserContext(profile);
return NULL;
}
void AppListControllerDelegate::GetApps(Profile* profile,
extensions::ExtensionSet* out_apps) {
ExtensionRegistry* registry = ExtensionRegistry::Get(profile);
DCHECK(registry);
out_apps->InsertAll(registry->enabled_extensions());
out_apps->InsertAll(registry->disabled_extensions());
out_apps->InsertAll(registry->terminated_extensions());
}
void AppListControllerDelegate::OnSearchStarted() { void AppListControllerDelegate::OnSearchStarted() {
#if BUILDFLAG(ENABLE_RLZ) #if BUILDFLAG(ENABLE_RLZ)
rlz::RLZTracker::RecordAppListSearch(); rlz::RLZTracker::RecordAppListSearch();
......
...@@ -18,28 +18,11 @@ ...@@ -18,28 +18,11 @@
class Profile; class Profile;
namespace extensions {
class Extension;
class ExtensionSet;
class InstallTracker;
} // namespace extensions
namespace gfx {
class Rect;
}
// Interface to allow the view delegate to call out to whatever is controlling // Interface to allow the view delegate to call out to whatever is controlling
// the app list. This will have different implementations for different // the app list. This will have different implementations for different
// platforms. // platforms.
class AppListControllerDelegate { class AppListControllerDelegate {
public: public:
// Indicates the source of an app list activation, for tracking purposes.
enum AppListSource {
LAUNCH_FROM_UNKNOWN,
LAUNCH_FROM_APP_LIST,
LAUNCH_FROM_APP_LIST_SEARCH
};
// Whether apps can be pinned, and whether pinned apps are editable or fixed. // Whether apps can be pinned, and whether pinned apps are editable or fixed.
// TODO(khmel): Find better home for Pinnable enum. // TODO(khmel): Find better home for Pinnable enum.
enum Pinnable { enum Pinnable {
...@@ -60,13 +43,6 @@ class AppListControllerDelegate { ...@@ -60,13 +43,6 @@ class AppListControllerDelegate {
// Gets display ID of app list window. // Gets display ID of app list window.
virtual int64_t GetAppListDisplayId() = 0; virtual int64_t GetAppListDisplayId() = 0;
// Gets the content bounds of the app info dialog of the app list in the
// screen coordinates. On platforms that do not use views, this returns a 0x0
// rectangle.
using GetAppInfoDialogBoundsCallback =
base::OnceCallback<void(const gfx::Rect&)>;
virtual void GetAppInfoDialogBounds(GetAppInfoDialogBoundsCallback callback);
// Control of pinning apps. // Control of pinning apps.
virtual bool IsAppPinned(const std::string& app_id) = 0; virtual bool IsAppPinned(const std::string& app_id) = 0;
virtual void PinApp(const std::string& app_id) = 0; virtual void PinApp(const std::string& app_id) = 0;
...@@ -90,38 +66,9 @@ class AppListControllerDelegate { ...@@ -90,38 +66,9 @@ class AppListControllerDelegate {
ui::PageTransition transition, ui::PageTransition transition,
WindowOpenDisposition disposition) = 0; WindowOpenDisposition disposition) = 0;
// Show the app's most recent window, or launch it if it is not running.
virtual void ActivateApp(Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags) = 0;
// Launch the app on the display identified by |display_id|.
virtual void LaunchApp(Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags,
int64_t display_id) = 0;
static std::string AppListSourceToString(AppListSource source);
// True if the user has permission to modify the given app's settings.
bool UninstallAllowed(Profile* profile, const std::string& app_id);
// Uninstall the app identified by |app_id| from |profile|. // Uninstall the app identified by |app_id| from |profile|.
void UninstallApp(Profile* profile, const std::string& app_id); void UninstallApp(Profile* profile, const std::string& app_id);
// True if the app was installed from the web store.
bool IsAppFromWebStore(Profile* profile, const std::string& app_id);
// Shows the user the webstore site for the given app.
void ShowAppInWebStore(Profile* profile,
const std::string& app_id,
bool is_search_result);
// True if the given extension has an options page.
bool HasOptionsPage(Profile* profile, const std::string& app_id);
// Shows the user the options page for the app. // Shows the user the options page for the app.
void ShowOptionsPage(Profile* profile, const std::string& app_id); void ShowOptionsPage(Profile* profile, const std::string& app_id);
...@@ -134,15 +81,6 @@ class AppListControllerDelegate { ...@@ -134,15 +81,6 @@ class AppListControllerDelegate {
const std::string& extension_id, const std::string& extension_id,
extensions::LaunchType launch_type); extensions::LaunchType launch_type);
// Returns true if the given extension is installed.
virtual bool IsExtensionInstalled(Profile* profile,
const std::string& app_id);
extensions::InstallTracker* GetInstallTrackerFor(Profile* profile);
// Get the list of installed apps for the given profile.
void GetApps(Profile* profile, extensions::ExtensionSet* out_apps);
// Called when a search is started using the app list search box. // Called when a search is started using the app list search box.
void OnSearchStarted(); void OnSearchStarted();
......
...@@ -62,21 +62,6 @@ void TestAppListControllerDelegate::OpenURL(Profile* profile, ...@@ -62,21 +62,6 @@ void TestAppListControllerDelegate::OpenURL(Profile* profile,
last_opened_url_ = url; last_opened_url_ = url;
} }
void TestAppListControllerDelegate::ActivateApp(
Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags) {
}
void TestAppListControllerDelegate::LaunchApp(
Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags,
int64_t display_id) {
}
void TestAppListControllerDelegate::Reset() { void TestAppListControllerDelegate::Reset() {
did_dismiss_view_ = false; did_dismiss_view_ = false;
last_opened_url_ = GURL(); last_opened_url_ = GURL();
......
...@@ -31,15 +31,6 @@ class TestAppListControllerDelegate : public AppListControllerDelegate { ...@@ -31,15 +31,6 @@ class TestAppListControllerDelegate : public AppListControllerDelegate {
const GURL& url, const GURL& url,
ui::PageTransition transition, ui::PageTransition transition,
WindowOpenDisposition deposition) override; WindowOpenDisposition deposition) override;
void ActivateApp(Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags) override;
void LaunchApp(Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags,
int64_t display_id) override;
void Reset(); void Reset();
......
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