| 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/app_list_controller_delegate.h" | 8 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 9 #include "chrome/browser/ui/app_list/apps_model_builder.h" | 9 #include "chrome/browser/ui/app_list/apps_model_builder.h" |
| 10 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" | 10 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" |
| 11 #include "chrome/browser/ui/app_list/search_builder.h" | 11 #include "chrome/browser/ui/app_list/search_builder.h" |
| 12 #include "content/public/browser/user_metrics.h" | 12 #include "content/public/browser/user_metrics.h" |
| 13 | 13 |
| 14 #if defined(USE_ASH) | 14 #if defined(USE_ASH) |
| 15 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" | 15 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller) | 18 AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller, |
| 19 : controller_(controller) {} | 19 Profile* profile) |
| 20 : controller_(controller), |
| 21 profile_(profile) {} |
| 20 | 22 |
| 21 AppListViewDelegate::~AppListViewDelegate() {} | 23 AppListViewDelegate::~AppListViewDelegate() {} |
| 22 | 24 |
| 23 void AppListViewDelegate::SetModel(app_list::AppListModel* model) { | 25 void AppListViewDelegate::SetModel(app_list::AppListModel* model) { |
| 24 if (model) { | 26 if (model) { |
| 25 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 27 apps_builder_.reset(new AppsModelBuilder(profile_, |
| 26 apps_builder_.reset(new AppsModelBuilder(profile, | |
| 27 model->apps(), | 28 model->apps(), |
| 28 controller_.get())); | 29 controller_.get())); |
| 29 apps_builder_->Build(); | 30 apps_builder_->Build(); |
| 30 | 31 |
| 31 search_builder_.reset(new SearchBuilder(profile, | 32 search_builder_.reset(new SearchBuilder(profile_, |
| 32 model->search_box(), | 33 model->search_box(), |
| 33 model->results(), | 34 model->results(), |
| 34 controller_.get())); | 35 controller_.get())); |
| 35 #if defined(USE_ASH) | 36 #if defined(USE_ASH) |
| 36 app_sync_ui_state_watcher_.reset(new AppSyncUIStateWatcher(profile, model)); | 37 app_sync_ui_state_watcher_.reset(new AppSyncUIStateWatcher(profile_, |
| 38 model)); |
| 37 #endif | 39 #endif |
| 38 } else { | 40 } else { |
| 39 apps_builder_.reset(); | 41 apps_builder_.reset(); |
| 40 search_builder_.reset(); | 42 search_builder_.reset(); |
| 41 #if defined(USE_ASH) | 43 #if defined(USE_ASH) |
| 42 app_sync_ui_state_watcher_.reset(); | 44 app_sync_ui_state_watcher_.reset(); |
| 43 #endif | 45 #endif |
| 44 } | 46 } |
| 45 } | 47 } |
| 46 | 48 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 controller_->DismissView(); | 82 controller_->DismissView(); |
| 81 } | 83 } |
| 82 | 84 |
| 83 void AppListViewDelegate::ViewClosing() { | 85 void AppListViewDelegate::ViewClosing() { |
| 84 controller_->ViewClosing(); | 86 controller_->ViewClosing(); |
| 85 } | 87 } |
| 86 | 88 |
| 87 void AppListViewDelegate::ViewActivationChanged(bool active) { | 89 void AppListViewDelegate::ViewActivationChanged(bool active) { |
| 88 controller_->ViewActivationChanged(active); | 90 controller_->ViewActivationChanged(active); |
| 89 } | 91 } |
| OLD | NEW |