| Index: chrome/browser/ui/app_list/arc/arc_app_utils.cc
|
| diff --git a/chrome/browser/ui/app_list/arc/arc_app_utils.cc b/chrome/browser/ui/app_list/arc/arc_app_utils.cc
|
| index 12b6727d88b417654d242a7ce1b19c0b02c59981..a120f6474a876159f94a80c28195ebb249bf404c 100644
|
| --- a/chrome/browser/ui/app_list/arc/arc_app_utils.cc
|
| +++ b/chrome/browser/ui/app_list/arc/arc_app_utils.cc
|
| @@ -9,9 +9,7 @@
|
|
|
| #include "ash/shell.h"
|
| #include "base/bind.h"
|
| -#include "base/json/json_writer.h"
|
| #include "base/synchronization/waitable_event.h"
|
| -#include "base/values.h"
|
| #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
|
| #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h"
|
| #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
|
| @@ -22,7 +20,6 @@
|
| #include "ui/aura/window.h"
|
| #include "ui/display/display.h"
|
| #include "ui/display/screen.h"
|
| -#include "ui/events/event_constants.h"
|
|
|
| namespace arc {
|
|
|
| @@ -53,16 +50,6 @@
|
| constexpr char kShowPackageInfoStr[] = "show package info";
|
| constexpr char kUninstallPackageStr[] = "uninstall package";
|
|
|
| -// Intent helper strings.
|
| -constexpr char kIntentHelperClassName[] =
|
| - "org.chromium.arc.intent_helper.SettingsReceiver";
|
| -constexpr char kIntentHelperPackageName[] = "org.chromium.arc.intent_helper";
|
| -constexpr char kSendBroadcastStr[] = "SendBroadcast";
|
| -constexpr char kSetInTouchModeIntent[] =
|
| - "org.chromium.arc.intent_helper.SET_IN_TOUCH_MODE";
|
| -constexpr char kShowTalkbackSettingsIntent[] =
|
| - "org.chromium.arc.intent_helper.SHOW_TALKBACK_SETTINGS";
|
| -
|
| // Helper function which returns the AppInstance. Create related logs when error
|
| // happens.
|
| arc::mojom::AppInstance* GetAppInstance(uint32_t required_version,
|
| @@ -76,22 +63,6 @@
|
|
|
| return bridge_service->app()->GetInstanceForMethod(service_name.c_str(),
|
| required_version);
|
| -}
|
| -
|
| -// Helper function which returns the IntentHelperInstance. Create related logs
|
| -// when error happens.
|
| -arc::mojom::IntentHelperInstance* GetIntentHelperInstance(
|
| - uint32_t required_version,
|
| - const std::string& service_name) {
|
| - arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get();
|
| - if (!bridge_service) {
|
| - VLOG(2) << "Request to " << service_name
|
| - << " when bridge service is not ready.";
|
| - return nullptr;
|
| - }
|
| -
|
| - return bridge_service->intent_helper()->GetInstanceForMethod(
|
| - service_name.c_str(), required_version);
|
| }
|
|
|
| void PrioritizeArcInstanceCallback(bool success) {
|
| @@ -131,13 +102,6 @@
|
| return result;
|
| }
|
|
|
| -// Returns true if |event_flags| came from a mouse or touch event.
|
| -bool IsMouseOrTouchEventFromFlags(int event_flags) {
|
| - return (event_flags & (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON |
|
| - ui::EF_RIGHT_MOUSE_BUTTON | ui::EF_BACK_MOUSE_BUTTON |
|
| - ui::EF_FORWARD_MOUSE_BUTTON | ui::EF_FROM_TOUCH)) != 0;
|
| -}
|
| -
|
| // A class which handles the asynchronous ARC runtime callback to figure out if
|
| // an app can handle a certain resolution or not.
|
| // After LaunchAndRelease() got called, the object will destroy itself once
|
| @@ -146,12 +110,8 @@
|
| public:
|
| LaunchAppWithoutSize(content::BrowserContext* context,
|
| const std::string& app_id,
|
| - bool landscape_mode,
|
| - int event_flags)
|
| - : context_(context),
|
| - app_id_(app_id),
|
| - landscape_mode_(landscape_mode),
|
| - event_flags_(event_flags) {}
|
| + bool landscape_mode)
|
| + : context_(context), app_id_(app_id), landscape_mode_(landscape_mode) {}
|
|
|
| // This will launch the request and after the return the creator does not
|
| // need to delete the object anymore.
|
| @@ -160,7 +120,7 @@
|
| : gfx::Rect(0, 0, kNexus5Width, kNexus5Height);
|
| if (!ash::Shell::HasInstance()) {
|
| // Skip this if there is no Ash shell.
|
| - LaunchAppWithRect(context_, app_id_, landscape_, event_flags_);
|
| + LaunchAppWithRect(context_, app_id_, landscape_);
|
| delete this;
|
| return true;
|
| }
|
| @@ -183,15 +143,13 @@
|
| const std::string app_id_;
|
| const bool landscape_mode_;
|
| gfx::Rect landscape_;
|
| - const int event_flags_;
|
|
|
| // The callback handler which gets called from the CanHandleResolution
|
| // function.
|
| void Callback(bool can_handle) {
|
| gfx::Size target_size =
|
| can_handle ? landscape_.size() : gfx::Size(kNexus5Width, kNexus5Height);
|
| - LaunchAppWithRect(context_, app_id_, GetTargetRect(target_size),
|
| - event_flags_);
|
| + LaunchAppWithRect(context_, app_id_, GetTargetRect(target_size));
|
| // Now that we are done, we can delete ourselves.
|
| delete this;
|
| }
|
| @@ -212,8 +170,7 @@
|
|
|
| bool LaunchAppWithRect(content::BrowserContext* context,
|
| const std::string& app_id,
|
| - const gfx::Rect& target_rect,
|
| - int event_flags) {
|
| + const gfx::Rect& target_rect) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context);
|
| CHECK(prefs);
|
|
|
| @@ -237,18 +194,6 @@
|
| GetAppInstance(kMinVersion, kLaunchAppStr);
|
| if (!app_instance)
|
| return false;
|
| -
|
| - arc::mojom::IntentHelperInstance* intent_helper_instance =
|
| - GetIntentHelperInstance(kSendBroadcastMinVersion, kSendBroadcastStr);
|
| - if (intent_helper_instance) {
|
| - base::DictionaryValue extras;
|
| - extras.SetBoolean("inTouchMode", IsMouseOrTouchEventFromFlags(event_flags));
|
| - std::string extras_string;
|
| - base::JSONWriter::Write(extras, &extras_string);
|
| - intent_helper_instance->SendBroadcast(
|
| - kSetInTouchModeIntent, kIntentHelperPackageName, kIntentHelperClassName,
|
| - extras_string);
|
| - }
|
|
|
| if (app_info->shortcut) {
|
| app_instance->LaunchIntent(app_info->intent_uri, target_rect);
|
| @@ -261,24 +206,18 @@
|
| return true;
|
| }
|
|
|
| -bool LaunchAndroidSettingsApp(content::BrowserContext* context,
|
| - int event_flags) {
|
| +bool LaunchAndroidSettingsApp(content::BrowserContext* context) {
|
| constexpr bool kUseLandscapeLayout = true;
|
| - return arc::LaunchApp(context, kSettingsAppId, kUseLandscapeLayout,
|
| - event_flags);
|
| + return arc::LaunchApp(context, kSettingsAppId, kUseLandscapeLayout);
|
| +}
|
| +
|
| +bool LaunchApp(content::BrowserContext* context, const std::string& app_id) {
|
| + return LaunchApp(context, app_id, true);
|
| }
|
|
|
| bool LaunchApp(content::BrowserContext* context,
|
| const std::string& app_id,
|
| - int event_flags) {
|
| - constexpr bool kUseLandscapeLayout = true;
|
| - return LaunchApp(context, app_id, kUseLandscapeLayout, event_flags);
|
| -}
|
| -
|
| -bool LaunchApp(content::BrowserContext* context,
|
| - const std::string& app_id,
|
| - bool landscape_layout,
|
| - int event_flags) {
|
| + bool landscape_layout) {
|
| ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context);
|
| std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id);
|
| if (app_info && !app_info->ready) {
|
| @@ -309,7 +248,7 @@
|
| DCHECK(chrome_controller || !ash::Shell::HasInstance());
|
| if (chrome_controller) {
|
| chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(
|
| - app_id, event_flags);
|
| + app_id);
|
|
|
| // On some boards, ARC is booted with a restricted set of resources by
|
| // default to avoid slowing down Chrome's user session restoration.
|
| @@ -326,8 +265,7 @@
|
| return true;
|
| }
|
|
|
| - return (new LaunchAppWithoutSize(context, app_id, landscape_layout,
|
| - event_flags))
|
| + return (new LaunchAppWithoutSize(context, app_id, landscape_layout))
|
| ->LaunchAndRelease();
|
| }
|
|
|
| @@ -348,14 +286,23 @@
|
| }
|
|
|
| void ShowTalkBackSettings() {
|
| - arc::mojom::IntentHelperInstance* intent_helper_instance =
|
| - GetIntentHelperInstance(kSendBroadcastMinVersion, kSendBroadcastStr);
|
| + arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get();
|
| + if (!bridge_service) {
|
| + VLOG(2) << "ARC bridge is not ready";
|
| + return;
|
| + }
|
| +
|
| + auto* intent_helper_instance =
|
| + bridge_service->intent_helper()->GetInstanceForMethod(
|
| + "SendBroadcast", kSendBroadcastMinVersion);
|
| if (!intent_helper_instance)
|
| return;
|
|
|
| - intent_helper_instance->SendBroadcast(kShowTalkbackSettingsIntent,
|
| - kIntentHelperPackageName,
|
| - kIntentHelperClassName, "{}");
|
| + intent_helper_instance->SendBroadcast(
|
| + "org.chromium.arc.intent_helper.SHOW_TALKBACK_SETTINGS",
|
| + "org.chromium.arc.intent_helper",
|
| + "org.chromium.arc.intent_helper.SettingsReceiver",
|
| + "{}");
|
| }
|
|
|
| bool CanHandleResolution(content::BrowserContext* context,
|
|
|