Chromium Code Reviews| 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), profile_(profile) {} | |
|
xiyuan
2013/01/23 00:09:33
nit: one member per line
koz (OOO until 15th September)
2013/01/23 00:16:43
Done.
| |
| 20 | 21 |
| 21 AppListViewDelegate::~AppListViewDelegate() {} | 22 AppListViewDelegate::~AppListViewDelegate() {} |
| 22 | 23 |
| 23 void AppListViewDelegate::SetModel(app_list::AppListModel* model) { | 24 void AppListViewDelegate::SetModel(app_list::AppListModel* model) { |
| 24 if (model) { | 25 if (model) { |
| 25 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 26 apps_builder_.reset(new AppsModelBuilder(profile_, |
| 26 apps_builder_.reset(new AppsModelBuilder(profile, | |
| 27 model->apps(), | 27 model->apps(), |
| 28 controller_.get())); | 28 controller_.get())); |
| 29 apps_builder_->Build(); | 29 apps_builder_->Build(); |
| 30 | 30 |
| 31 search_builder_.reset(new SearchBuilder(profile, | 31 search_builder_.reset(new SearchBuilder(profile_, |
| 32 model->search_box(), | 32 model->search_box(), |
| 33 model->results(), | 33 model->results(), |
| 34 controller_.get())); | 34 controller_.get())); |
| 35 #if defined(USE_ASH) | 35 #if defined(USE_ASH) |
| 36 app_sync_ui_state_watcher_.reset(new AppSyncUIStateWatcher(profile, model)); | 36 app_sync_ui_state_watcher_.reset(new AppSyncUIStateWatcher(profile_, |
| 37 model)); | |
| 37 #endif | 38 #endif |
| 38 } else { | 39 } else { |
| 39 apps_builder_.reset(); | 40 apps_builder_.reset(); |
| 40 search_builder_.reset(); | 41 search_builder_.reset(); |
| 41 #if defined(USE_ASH) | 42 #if defined(USE_ASH) |
| 42 app_sync_ui_state_watcher_.reset(); | 43 app_sync_ui_state_watcher_.reset(); |
| 43 #endif | 44 #endif |
| 44 } | 45 } |
| 45 } | 46 } |
| 46 | 47 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 controller_->DismissView(); | 81 controller_->DismissView(); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void AppListViewDelegate::ViewClosing() { | 84 void AppListViewDelegate::ViewClosing() { |
| 84 controller_->ViewClosing(); | 85 controller_->ViewClosing(); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void AppListViewDelegate::ViewActivationChanged(bool active) { | 88 void AppListViewDelegate::ViewActivationChanged(bool active) { |
| 88 controller_->ViewActivationChanged(active); | 89 controller_->ViewActivationChanged(active); |
| 89 } | 90 } |
| OLD | NEW |