| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "chrome/browser/ui/app_list/app_list_shower.h" | 7 #include "chrome/browser/ui/app_list/app_list_shower.h" |
| 8 | 8 |
| 9 AppListShower::AppListShower(scoped_ptr<AppListFactory> factory, | 9 AppListShower::AppListShower(scoped_ptr<AppListFactory> factory, |
| 10 scoped_ptr<KeepAliveService> keep_alive, | 10 scoped_ptr<KeepAliveService> keep_alive, |
| 11 AppListService* service) | 11 AppListService* service) |
| 12 : factory_(factory.Pass()), | 12 : factory_(factory.Pass()), |
| 13 keep_alive_service_(keep_alive.Pass()), | 13 keep_alive_service_(keep_alive.Pass()), |
| 14 service_(service), | 14 service_(service), |
| 15 profile_(NULL), | 15 profile_(NULL), |
| 16 can_close_app_list_(true) { | 16 can_close_app_list_(true) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 AppListShower::~AppListShower() { | 19 AppListShower::~AppListShower() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 void AppListShower::ShowAndReacquireFocus(Profile* requested_profile) { | |
| 23 ShowForProfile(requested_profile); | |
| 24 app_list_->ReactivateOnNextFocusLoss(); | |
| 25 } | |
| 26 | |
| 27 void AppListShower::ShowForProfile(Profile* requested_profile) { | 22 void AppListShower::ShowForProfile(Profile* requested_profile) { |
| 28 // If the app list is already displaying |profile| just activate it (in case | 23 // If the app list is already displaying |profile| just activate it (in case |
| 29 // we have lost focus). | 24 // we have lost focus). |
| 30 if (IsAppListVisible() && (requested_profile == profile_)) { | 25 if (IsAppListVisible() && (requested_profile == profile_)) { |
| 31 app_list_->Show(); | 26 app_list_->Show(); |
| 32 return; | 27 return; |
| 33 } | 28 } |
| 34 | 29 |
| 35 if (!app_list_) { | 30 if (!app_list_) { |
| 36 CreateViewForProfile(requested_profile); | 31 CreateViewForProfile(requested_profile); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 90 |
| 96 void AppListShower::WarmupForProfile(Profile* profile) { | 91 void AppListShower::WarmupForProfile(Profile* profile) { |
| 97 DCHECK(!profile_); | 92 DCHECK(!profile_); |
| 98 CreateViewForProfile(profile); | 93 CreateViewForProfile(profile); |
| 99 app_list_->Prerender(); | 94 app_list_->Prerender(); |
| 100 } | 95 } |
| 101 | 96 |
| 102 bool AppListShower::HasView() const { | 97 bool AppListShower::HasView() const { |
| 103 return !!app_list_; | 98 return !!app_list_; |
| 104 } | 99 } |
| OLD | NEW |