Commit 9425a1c5 authored by Jit Yao Yap's avatar Jit Yao Yap Committed by Commit Bot

Update Remote Apps to be unpinnable

This CL prevents Remote Apps from being pinned when dragging the
launcher item onto the shelf.

Remote Apps already do not have a context menu item for pinning, so this
CL makes Remote Apps unpinnable.

Bug: 1101208
Change-Id: Iaa25530dc84d20cc420a8a407898979ef7a558de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2382606
Commit-Queue: Jit Yao Yap <jityao@google.com>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804084}
parent f806ba6f
......@@ -19,6 +19,7 @@
#include "ash/public/cpp/shelf_types.h"
#include "ash/public/cpp/window_properties.h"
#include "ash/screen_util.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shelf/hotseat_widget.h"
#include "ash/shelf/scrollable_shelf_view.h"
#include "ash/shelf/shelf.h"
......@@ -51,6 +52,9 @@
#include "base/strings/utf_string_conversions.h"
#include "base/timer/timer.h"
#include "chromeos/constants/chromeos_switches.h"
#include "components/account_id/account_id.h"
#include "components/services/app_service/public/cpp/app_registry_cache_wrapper.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -253,6 +257,15 @@ bool ShouldIncludeMenuItem(aura::Window* window) {
return desks_util::BelongsToActiveDesk(window);
}
// Returns true if the app associated with |app_id| is a Remote App.
bool IsRemoteApp(const std::string& app_id) {
AccountId account_id =
Shell::Get()->session_controller()->GetActiveAccountId();
apps::AppRegistryCache* cache =
apps::AppRegistryCacheWrapper::Get().GetAppRegistryCache(account_id);
return cache && cache->GetAppType(app_id) == apps::mojom::AppType::kRemote;
}
} // namespace
// ImplicitAnimationObserver used when adding an item.
......@@ -1111,6 +1124,10 @@ ShelfView::RetrieveDragIconProxyAndClearDragProxyState() {
bool ShelfView::ShouldStartDrag(
const std::string& app_id,
const gfx::Point& location_in_screen_coordinates) const {
// Remote Apps are not pinnable.
if (IsRemoteApp(app_id))
return false;
// Do not start drag if an operation is already going on - or the cursor is
// not inside. This could happen if mouse / touch operations overlap.
return (drag_and_drop_shelf_id_.IsNull() && !app_id.empty() &&
......
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