Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / app_list / app_list_service_views.cc
index 072ee57..51912df 100644 (file)
@@ -4,8 +4,9 @@
 
 #include "chrome/browser/ui/app_list/app_list_service_views.h"
 
+#include "chrome/browser/apps/scoped_keep_alive.h"
 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
-#include "chrome/browser/ui/app_list/scoped_keep_alive.h"
+#include "ui/app_list/views/app_list_view.h"
 
 AppListServiceViews::AppListServiceViews(
     scoped_ptr<AppListControllerDelegate> controller_delegate)
@@ -63,7 +64,16 @@ AppListControllerDelegate* AppListServiceViews::GetControllerDelegate() {
   return controller_delegate_.get();
 }
 
-AppListControllerDelegate*
-AppListServiceViews::GetControllerDelegateForCreate() {
-  return controller_delegate_.get();
+void AppListServiceViews::DestroyAppList() {
+  if (!shower_.HasView())
+    return;
+
+  // Use CloseNow(). This can't be asynchronous because the profile will be
+  // deleted once this function returns.
+  shower_.app_list()->GetWidget()->CloseNow();
+  DCHECK(!shower_.HasView());
+}
+
+AppListViewDelegate* AppListServiceViews::GetViewDelegateForCreate() {
+  return GetViewDelegate(shower_.profile());
 }