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