OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/app_list/app_list_service_views.h" |
| 6 |
| 7 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 8 #include "chrome/browser/ui/app_list/app_list_creator.h" |
| 9 |
| 10 AppListServiceViews::AppListServiceViews( |
| 11 scoped_ptr<AppListControllerDelegate> controller_delegate) |
| 12 : creator_(new AppListCreator(this)), |
| 13 controller_delegate_(controller_delegate.Pass()) |
| 14 } |
| 15 |
| 16 AppListServiceViews::~AppListServiceViews() {} |
| 17 |
| 18 void AppListServiceViews::OnAppListClosing() { |
| 19 can_close_ = true; |
| 20 creator_->AppListWillBeDestroyed(); |
| 21 } |
| 22 |
| 23 void AppListServiceViews::Init(Profile* initial_profile) { |
| 24 PerformStartupChecks(initial_profile); |
| 25 } |
| 26 |
| 27 void AppListServiceViews::CreateForProfile(Profile* requested_profile) { |
| 28 creator_->CreateViewForProfile(requested_profile); |
| 29 } |
| 30 |
| 31 void AppListServiceViews::ShowForProfile(Profile* requested_profile) { |
| 32 DCHECK(requested_profile); |
| 33 if (requested_profile->IsManaged()) |
| 34 return; |
| 35 |
| 36 AutoKeepAlive show_app_list_keepalive; |
| 37 |
| 38 InvalidatePendingProfileLoads(); |
| 39 SetProfilePath(requested_profile->GetPath()); |
| 40 creator_->ShowForProfile(requested_profile); |
| 41 RecordAppListLaunch(); |
| 42 } |
| 43 |
| 44 void AppListServiceViews::DismissAppList() { |
| 45 creator_->DismissAppList(); |
| 46 } |
| 47 |
| 48 bool AppListServiceViews::IsAppListVisible() const { |
| 49 return creator_->IsAppListVisible(); |
| 50 } |
| 51 |
| 52 gfx::NativeWindow AppListServiceViews::GetAppListWindow() { |
| 53 return creator_->GetWindow(); |
| 54 } |
| 55 |
| 56 Profile* AppListServiceViews::GetCurrentAppListProfile() { |
| 57 return creator_->profile(); |
| 58 } |
| 59 |
| 60 AppListControllerDelegate* AppListServiceViews::GetControllerDelegate() { |
| 61 return controller_delegate_.get(); |
| 62 } |
| 63 |
| 64 AppListControllerDelegate* |
| 65 AppListServiceViews::GetControllerDelegateForCreate() { |
| 66 return controller_delegate_.get(); |
| 67 } |
| 68 |
| 69 bool AppListServiceViews::CanCloseAppList() { |
| 70 return can_close_; |
| 71 } |
| 72 |
| 73 void AppListServiceViews::EnsureKeepAlive() { |
| 74 if (!keep_alive_) |
| 75 keep_alive_.reset(new AutoKeepAlive()); |
| 76 } |
| 77 |
| 78 void AppListServiceViews::FreeKeepAlive() { |
| 79 if (keep_alive_) |
| 80 keep_alive_.reset(); |
| 81 } |
OLD | NEW |