Index: chrome/browser/ui/app_list/app_list_service_views.cc |
diff --git a/chrome/browser/ui/app_list/app_list_service_views.cc b/chrome/browser/ui/app_list/app_list_service_views.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cdeecffab39887894e7fddd9d7f60f37ffd1eec1 |
--- /dev/null |
+++ b/chrome/browser/ui/app_list/app_list_service_views.cc |
@@ -0,0 +1,81 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/app_list/app_list_service_views.h" |
+ |
+#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
+#include "chrome/browser/ui/app_list/app_list_creator.h" |
+ |
+AppListServiceViews::AppListServiceViews( |
+ scoped_ptr<AppListControllerDelegate> controller_delegate) |
+ : creator_(new AppListCreator(this)), |
+ controller_delegate_(controller_delegate.Pass()) |
+} |
+ |
+AppListServiceViews::~AppListServiceViews() {} |
+ |
+void AppListServiceViews::OnAppListClosing() { |
+ can_close_ = true; |
+ creator_->AppListWillBeDestroyed(); |
+} |
+ |
+void AppListServiceViews::Init(Profile* initial_profile) { |
+ PerformStartupChecks(initial_profile); |
+} |
+ |
+void AppListServiceViews::CreateForProfile(Profile* requested_profile) { |
+ creator_->CreateViewForProfile(requested_profile); |
+} |
+ |
+void AppListServiceViews::ShowForProfile(Profile* requested_profile) { |
+ DCHECK(requested_profile); |
+ if (requested_profile->IsManaged()) |
+ return; |
+ |
+ AutoKeepAlive show_app_list_keepalive; |
+ |
+ InvalidatePendingProfileLoads(); |
+ SetProfilePath(requested_profile->GetPath()); |
+ creator_->ShowForProfile(requested_profile); |
+ RecordAppListLaunch(); |
+} |
+ |
+void AppListServiceViews::DismissAppList() { |
+ creator_->DismissAppList(); |
+} |
+ |
+bool AppListServiceViews::IsAppListVisible() const { |
+ return creator_->IsAppListVisible(); |
+} |
+ |
+gfx::NativeWindow AppListServiceViews::GetAppListWindow() { |
+ return creator_->GetWindow(); |
+} |
+ |
+Profile* AppListServiceViews::GetCurrentAppListProfile() { |
+ return creator_->profile(); |
+} |
+ |
+AppListControllerDelegate* AppListServiceViews::GetControllerDelegate() { |
+ return controller_delegate_.get(); |
+} |
+ |
+AppListControllerDelegate* |
+AppListServiceViews::GetControllerDelegateForCreate() { |
+ return controller_delegate_.get(); |
+} |
+ |
+bool AppListServiceViews::CanCloseAppList() { |
+ return can_close_; |
+} |
+ |
+void AppListServiceViews::EnsureKeepAlive() { |
+ if (!keep_alive_) |
+ keep_alive_.reset(new AutoKeepAlive()); |
+} |
+ |
+void AppListServiceViews::FreeKeepAlive() { |
+ if (keep_alive_) |
+ keep_alive_.reset(); |
+} |