| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/feature_list.h" | |
| 13 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 14 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 15 #include "base/values.h" | 14 #include "base/values.h" |
| 16 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 15 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 17 #include "chrome/browser/chromeos/arc/arc_util.h" | 16 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 18 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 20 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" | 19 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" |
| 21 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h" | 20 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h" |
| 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 23 #include "chromeos/dbus/dbus_thread_manager.h" | 22 #include "chromeos/dbus/dbus_thread_manager.h" |
| 24 #include "chromeos/dbus/session_manager_client.h" | 23 #include "chromeos/dbus/session_manager_client.h" |
| 25 #include "components/arc/arc_bridge_service.h" | 24 #include "components/arc/arc_bridge_service.h" |
| 26 #include "components/arc/arc_features.h" | |
| 27 #include "components/arc/arc_service_manager.h" | 25 #include "components/arc/arc_service_manager.h" |
| 28 #include "components/arc/arc_util.h" | 26 #include "components/arc/arc_util.h" |
| 29 #include "components/arc/common/intent_helper.mojom.h" | 27 #include "components/arc/common/intent_helper.mojom.h" |
| 30 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
| 31 #include "ui/display/display.h" | 29 #include "ui/display/display.h" |
| 32 #include "ui/display/screen.h" | 30 #include "ui/display/screen.h" |
| 33 #include "ui/events/event_constants.h" | 31 #include "ui/events/event_constants.h" |
| 34 | 32 |
| 35 // Helper macro which returns the AppInstance. | 33 // Helper macro which returns the AppInstance. |
| 36 #define GET_APP_INSTANCE(method_name) \ | 34 #define GET_APP_INSTANCE(method_name) \ |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 169 } |
| 172 | 170 |
| 173 DISALLOW_COPY_AND_ASSIGN(LaunchAppWithoutSize); | 171 DISALLOW_COPY_AND_ASSIGN(LaunchAppWithoutSize); |
| 174 }; | 172 }; |
| 175 | 173 |
| 176 } // namespace | 174 } // namespace |
| 177 | 175 |
| 178 const char kPlayStoreAppId[] = "gpkmicpkkebkmabiaedjognfppcchdfa"; | 176 const char kPlayStoreAppId[] = "gpkmicpkkebkmabiaedjognfppcchdfa"; |
| 179 const char kPlayStorePackage[] = "com.android.vending"; | 177 const char kPlayStorePackage[] = "com.android.vending"; |
| 180 const char kPlayStoreActivity[] = "com.android.vending.AssetBrowserActivity"; | 178 const char kPlayStoreActivity[] = "com.android.vending.AssetBrowserActivity"; |
| 181 const char kFilesAppId[] = "clippbnfpgifdekheldlleoeiiababjg"; | |
| 182 const char kSettingsAppId[] = "mconboelelhjpkbdhhiijkgcimoangdj"; | 179 const char kSettingsAppId[] = "mconboelelhjpkbdhhiijkgcimoangdj"; |
| 183 | 180 |
| 184 bool ShouldShowInLauncher(const std::string& app_id) { | 181 bool ShouldShowInLauncher(const std::string& app_id) { |
| 185 if (app_id == kFilesAppId) { | 182 return (app_id != kSettingsAppId); |
| 186 return base::FeatureList::IsEnabled(kShowArcFilesAppFeature); | |
| 187 } else { | |
| 188 return (app_id != kSettingsAppId); | |
| 189 } | |
| 190 } | 183 } |
| 191 | 184 |
| 192 bool LaunchAppWithRect(content::BrowserContext* context, | 185 bool LaunchAppWithRect(content::BrowserContext* context, |
| 193 const std::string& app_id, | 186 const std::string& app_id, |
| 194 const gfx::Rect& target_rect, | 187 const gfx::Rect& target_rect, |
| 195 int event_flags) { | 188 int event_flags) { |
| 196 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); | 189 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); |
| 197 CHECK(prefs); | 190 CHECK(prefs); |
| 198 | 191 |
| 199 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); | 192 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 return false; | 453 return false; |
| 461 | 454 |
| 462 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); | 455 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); |
| 463 if (!arc_prefs) | 456 if (!arc_prefs) |
| 464 return false; | 457 return false; |
| 465 | 458 |
| 466 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); | 459 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); |
| 467 } | 460 } |
| 468 | 461 |
| 469 } // namespace arc | 462 } // namespace arc |
| OLD | NEW |