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