Index: chrome/browser/ui/app_list/arc/arc_app_item.cc |
diff --git a/chrome/browser/ui/app_list/arc/arc_app_item.cc b/chrome/browser/ui/app_list/arc/arc_app_item.cc |
index 225ac4b1397249b1a3cb10013e6d186f089a18a3..05058609d8762b396560ed671c5d9d812a3cedc2 100644 |
--- a/chrome/browser/ui/app_list/arc/arc_app_item.cc |
+++ b/chrome/browser/ui/app_list/arc/arc_app_item.cc |
@@ -4,7 +4,10 @@ |
#include "chrome/browser/ui/app_list/arc/arc_app_item.h" |
+#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
+#include "chrome/browser/ui/app_list/app_list_service.h" |
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
+#include "chrome/browser/ui/host_desktop.h" |
#include "components/arc/arc_bridge_service.h" |
#include "content/public/browser/browser_thread.h" |
#include "extensions/browser/app_sorting.h" |
@@ -15,6 +18,8 @@ |
namespace { |
+bool g_disable_controller_delegate = false; |
+ |
gfx::ImageSkia CreateDisabledIcon(const gfx::ImageSkia& icon) { |
const color_utils::HSL shift = {-1, 0, 0.6}; |
return gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift); |
@@ -29,6 +34,11 @@ extensions::AppSorting* GetAppSorting(content::BrowserContext* context) { |
// static |
const char ArcAppItem::kItemType[] = "ArcAppItem"; |
+// static |
+void ArcAppItem::DisableContollerDelegateForTesting() { |
xiyuan
2015/12/09 17:20:29
I prefer to have something like
void OverrideAppL
khmel1
2015/12/10 05:19:04
That is nice. Thanks for sharing best practices. I
|
+ g_disable_controller_delegate = true; |
+} |
+ |
ArcAppItem::ArcAppItem( |
content::BrowserContext* context, |
const app_list::AppListSyncableService::SyncItem* sync_item, |
@@ -94,6 +104,9 @@ void ArcAppItem::Activate(int event_flags) { |
} |
bridge_service->LaunchApp(app_info->package, app_info->activity); |
+ |
+ if (!g_disable_controller_delegate) |
+ GetController()->DismissView(); |
} |
void ArcAppItem::SetReady(bool ready) { |
@@ -121,3 +134,8 @@ void ArcAppItem::UpdateIcon() { |
void ArcAppItem::OnIconUpdated() { |
UpdateIcon(); |
} |
+ |
+AppListControllerDelegate* ArcAppItem::GetController() { |
+ return AppListService::Get(chrome::GetActiveDesktop())-> |
khmel1
2015/12/09 13:42:08
I did similar to ExtensionsAppItem. However I don'
xiyuan
2015/12/09 17:20:29
We cannot put the AppListService etc into ui/ beca
khmel1
2015/12/10 05:19:04
Thanks for confirming that adding base class is ac
|
+ GetControllerDelegate(); |
+} |