| 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/lifetime/application_lifetime.h" |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 8 #include "chrome/browser/ui/app_list/apps_model_builder.h" | 9 #include "chrome/browser/ui/app_list/apps_model_builder.h" |
| 9 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" | 10 #include "chrome/browser/ui/app_list/chrome_app_list_item.h" |
| 10 #include "chrome/browser/ui/app_list/search_builder.h" | 11 #include "chrome/browser/ui/app_list/search_builder.h" |
| 11 #include "content/public/browser/user_metrics.h" | 12 #include "content/public/browser/user_metrics.h" |
| 12 | 13 |
| 13 AppListViewDelegate::AppListViewDelegate(AppListController* controller) | 14 AppListViewDelegate::AppListViewDelegate(AppListController* controller) |
| 14 : controller_(controller) {} | 15 : controller_(controller) { |
| 16 browser::StartKeepAlive(); |
| 17 } |
| 15 | 18 |
| 16 AppListViewDelegate::~AppListViewDelegate() {} | 19 AppListViewDelegate::~AppListViewDelegate() { |
| 20 browser::EndKeepAlive(); |
| 21 } |
| 17 | 22 |
| 18 void AppListViewDelegate::SetModel(app_list::AppListModel* model) { | 23 void AppListViewDelegate::SetModel(app_list::AppListModel* model) { |
| 19 if (model) { | 24 if (model) { |
| 20 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 25 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
| 21 apps_builder_.reset(new AppsModelBuilder(profile, | 26 apps_builder_.reset(new AppsModelBuilder(profile, |
| 22 model->apps(), | 27 model->apps(), |
| 23 controller_.get())); | 28 controller_.get())); |
| 24 apps_builder_->Build(); | 29 apps_builder_->Build(); |
| 25 | 30 |
| 26 search_builder_.reset(new SearchBuilder(profile, | 31 search_builder_.reset(new SearchBuilder(profile, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const app_list::SearchResult& result, | 66 const app_list::SearchResult& result, |
| 62 int action_index, | 67 int action_index, |
| 63 int event_flags) { | 68 int event_flags) { |
| 64 if (search_builder_.get()) | 69 if (search_builder_.get()) |
| 65 search_builder_->InvokeResultAction(result, action_index, event_flags); | 70 search_builder_->InvokeResultAction(result, action_index, event_flags); |
| 66 } | 71 } |
| 67 | 72 |
| 68 void AppListViewDelegate::Close() { | 73 void AppListViewDelegate::Close() { |
| 69 controller_->CloseView(); | 74 controller_->CloseView(); |
| 70 } | 75 } |
| 76 |
| 77 gfx::ImageSkia AppListViewDelegate::GetWindowAppIcon() { |
| 78 return controller_->GetWindowAppIcon(); |
| 79 } |
| OLD | NEW |