OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/app_list/app_list_service_views.h" | 5 #include "chrome/browser/ui/app_list/app_list_service_views.h" |
6 | 6 |
7 #include "chrome/browser/apps/scoped_keep_alive.h" | 7 #include "chrome/browser/apps/scoped_keep_alive.h" |
8 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 8 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 9 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
9 #include "ui/app_list/views/app_list_view.h" | 10 #include "ui/app_list/views/app_list_view.h" |
10 | 11 |
11 AppListServiceViews::AppListServiceViews( | 12 AppListServiceViews::AppListServiceViews( |
12 scoped_ptr<AppListControllerDelegate> controller_delegate) | 13 scoped_ptr<AppListControllerDelegate> controller_delegate) |
13 : shower_(this), | 14 : shower_(this), |
14 can_dismiss_(true), | 15 can_dismiss_(true), |
15 controller_delegate_(controller_delegate.Pass()) { | 16 controller_delegate_(controller_delegate.Pass()) { |
16 } | 17 } |
17 | 18 |
18 AppListServiceViews::~AppListServiceViews() {} | 19 AppListServiceViews::~AppListServiceViews() {} |
19 | 20 |
20 void AppListServiceViews::OnViewBeingDestroyed() { | 21 void AppListServiceViews::OnViewBeingDestroyed() { |
21 can_dismiss_ = true; | 22 can_dismiss_ = true; |
22 shower_.HandleViewBeingDestroyed(); | 23 shower_.HandleViewBeingDestroyed(); |
23 } | 24 } |
24 | 25 |
25 void AppListServiceViews::Init(Profile* initial_profile) { | 26 void AppListServiceViews::Init(Profile* initial_profile) { |
26 PerformStartupChecks(initial_profile); | 27 PerformStartupChecks(initial_profile); |
27 } | 28 } |
28 | 29 |
29 void AppListServiceViews::ShowForProfile(Profile* requested_profile) { | 30 void AppListServiceViews::ShowForProfile(Profile* requested_profile) { |
30 DCHECK(requested_profile); | 31 DCHECK(requested_profile); |
31 | 32 |
32 ScopedKeepAlive keep_alive; | 33 ScopedKeepAlive keep_alive; |
33 | 34 |
34 InvalidatePendingProfileLoads(); | 35 InvalidatePendingProfileLoads(); |
35 SetProfilePath(requested_profile->GetPath()); | 36 SetProfilePath(requested_profile->GetPath()); |
36 shower_.ShowForProfile(requested_profile); | 37 shower_.ShowForProfile(requested_profile); |
| 38 GetViewDelegate(requested_profile)->ViewInitialized(); |
37 RecordAppListLaunch(); | 39 RecordAppListLaunch(); |
38 } | 40 } |
39 | 41 |
40 void AppListServiceViews::DismissAppList() { | 42 void AppListServiceViews::DismissAppList() { |
41 if (!can_dismiss_) | 43 if (!can_dismiss_) |
42 return; | 44 return; |
43 | 45 |
44 shower_.DismissAppList(); | 46 shower_.DismissAppList(); |
45 } | 47 } |
46 | 48 |
(...skipping 23 matching lines...) Expand all Loading... |
70 | 72 |
71 // Use CloseNow(). This can't be asynchronous because the profile will be | 73 // Use CloseNow(). This can't be asynchronous because the profile will be |
72 // deleted once this function returns. | 74 // deleted once this function returns. |
73 shower_.app_list()->GetWidget()->CloseNow(); | 75 shower_.app_list()->GetWidget()->CloseNow(); |
74 DCHECK(!shower_.HasView()); | 76 DCHECK(!shower_.HasView()); |
75 } | 77 } |
76 | 78 |
77 AppListViewDelegate* AppListServiceViews::GetViewDelegateForCreate() { | 79 AppListViewDelegate* AppListServiceViews::GetViewDelegateForCreate() { |
78 return GetViewDelegate(shower_.profile()); | 80 return GetViewDelegate(shower_.profile()); |
79 } | 81 } |
OLD | NEW |