OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_view_delegate.h" | 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
8 #include "chrome/browser/ui/app_list/apps_model_builder.h" | 8 #include "chrome/browser/ui/app_list/apps_model_builder.h" |
9 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" | 9 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" |
10 #include "chrome/browser/ui/app_list/search_builder.h" | 10 #include "chrome/browser/ui/app_list/search_builder.h" |
11 #include "content/public/browser/user_metrics.h" | 11 #include "content/public/browser/user_metrics.h" |
12 | 12 |
| 13 #if defined(USE_ASH) |
| 14 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" |
| 15 #endif |
| 16 |
13 AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller) | 17 AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller) |
14 : controller_(controller) {} | 18 : controller_(controller) {} |
15 | 19 |
16 AppListViewDelegate::~AppListViewDelegate() {} | 20 AppListViewDelegate::~AppListViewDelegate() {} |
17 | 21 |
18 void AppListViewDelegate::SetModel(app_list::AppListModel* model) { | 22 void AppListViewDelegate::SetModel(app_list::AppListModel* model) { |
19 if (model) { | 23 if (model) { |
20 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 24 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
21 apps_builder_.reset(new AppsModelBuilder(profile, | 25 apps_builder_.reset(new AppsModelBuilder(profile, |
22 model->apps(), | 26 model->apps(), |
23 controller_.get())); | 27 controller_.get())); |
24 apps_builder_->Build(); | 28 apps_builder_->Build(); |
25 | 29 |
26 search_builder_.reset(new SearchBuilder(profile, | 30 search_builder_.reset(new SearchBuilder(profile, |
27 model->search_box(), | 31 model->search_box(), |
28 model->results(), | 32 model->results(), |
29 controller_.get())); | 33 controller_.get())); |
| 34 #if defined(USE_ASH) |
| 35 app_sync_ui_state_watcher_.reset(new AppSyncUIStateWatcher(profile, model)); |
| 36 #endif |
30 } else { | 37 } else { |
31 apps_builder_.reset(); | 38 apps_builder_.reset(); |
32 search_builder_.reset(); | 39 search_builder_.reset(); |
| 40 #if defined(USE_ASH) |
| 41 app_sync_ui_state_watcher_.reset(); |
| 42 #endif |
33 } | 43 } |
34 } | 44 } |
35 | 45 |
36 void AppListViewDelegate::ActivateAppListItem( | 46 void AppListViewDelegate::ActivateAppListItem( |
37 app_list::AppListItemModel* item, | 47 app_list::AppListItemModel* item, |
38 int event_flags) { | 48 int event_flags) { |
39 content::RecordAction(content::UserMetricsAction("AppList_ClickOnApp")); | 49 content::RecordAction(content::UserMetricsAction("AppList_ClickOnApp")); |
40 static_cast<ChromeAppListItem*>(item)->Activate(event_flags); | 50 static_cast<ChromeAppListItem*>(item)->Activate(event_flags); |
41 } | 51 } |
42 | 52 |
(...skipping 26 matching lines...) Expand all Loading... |
69 controller_->CloseView(); | 79 controller_->CloseView(); |
70 } | 80 } |
71 | 81 |
72 void AppListViewDelegate::ViewClosing() { | 82 void AppListViewDelegate::ViewClosing() { |
73 controller_->ViewClosing(); | 83 controller_->ViewClosing(); |
74 } | 84 } |
75 | 85 |
76 void AppListViewDelegate::ViewActivationChanged(bool active) { | 86 void AppListViewDelegate::ViewActivationChanged(bool active) { |
77 controller_->ViewActivationChanged(active); | 87 controller_->ViewActivationChanged(active); |
78 } | 88 } |
OLD | NEW |