| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "athena/home/app_list_view_delegate.h" | |
| 6 | |
| 7 #include <string> | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "athena/home/public/app_model_builder.h" | |
| 11 #include "athena/home/public/search_controller_factory.h" | |
| 12 #include "athena/strings/grit/athena_strings.h" | |
| 13 #include "base/basictypes.h" | |
| 14 #include "base/bind.h" | |
| 15 #include "base/callback.h" | |
| 16 #include "base/files/file_path.h" | |
| 17 #include "third_party/skia/include/core/SkBitmap.h" | |
| 18 #include "ui/app_list/app_list_model.h" | |
| 19 #include "ui/app_list/search_box_model.h" | |
| 20 #include "ui/app_list/search_controller.h" | |
| 21 #include "ui/app_list/search_provider.h" | |
| 22 #include "ui/app_list/search_result.h" | |
| 23 #include "ui/app_list/speech_ui_model.h" | |
| 24 #include "ui/base/l10n/l10n_util.h" | |
| 25 | |
| 26 namespace athena { | |
| 27 | |
| 28 AppListViewDelegate::AppListViewDelegate( | |
| 29 AppModelBuilder* model_builder, | |
| 30 SearchControllerFactory* search_factory) | |
| 31 : model_(new app_list::AppListModel), | |
| 32 speech_ui_(new app_list::SpeechUIModel) { | |
| 33 model_builder->RegisterAppListModel(model_.get()); | |
| 34 model_->search_box()->SetHintText( | |
| 35 l10n_util::GetStringUTF16(IDS_ATHENA_SEARCH_BOX_HINT)); | |
| 36 if (search_factory) { | |
| 37 search_controller_ = | |
| 38 search_factory->Create(model_->search_box(), model_->results()); | |
| 39 } | |
| 40 } | |
| 41 | |
| 42 AppListViewDelegate::~AppListViewDelegate() { | |
| 43 } | |
| 44 | |
| 45 bool AppListViewDelegate::ForceNativeDesktop() const { | |
| 46 return false; | |
| 47 } | |
| 48 | |
| 49 void AppListViewDelegate::SetProfileByPath(const base::FilePath& profile_path) { | |
| 50 // Nothing needs to be done. | |
| 51 } | |
| 52 | |
| 53 app_list::AppListModel* AppListViewDelegate::GetModel() { | |
| 54 return model_.get(); | |
| 55 } | |
| 56 | |
| 57 app_list::SpeechUIModel* AppListViewDelegate::GetSpeechUI() { | |
| 58 return speech_ui_.get(); | |
| 59 } | |
| 60 | |
| 61 void AppListViewDelegate::GetShortcutPathForApp( | |
| 62 const std::string& app_id, | |
| 63 const base::Callback<void(const base::FilePath&)>& callback) { | |
| 64 // Windows only, nothing is necessary. | |
| 65 } | |
| 66 | |
| 67 void AppListViewDelegate::StartSearch() { | |
| 68 if (search_controller_) | |
| 69 search_controller_->Start(false); | |
| 70 } | |
| 71 | |
| 72 void AppListViewDelegate::StopSearch() { | |
| 73 if (search_controller_) | |
| 74 search_controller_->Stop(); | |
| 75 } | |
| 76 | |
| 77 void AppListViewDelegate::OpenSearchResult(app_list::SearchResult* result, | |
| 78 bool auto_launch, | |
| 79 int event_flags) { | |
| 80 if (search_controller_) | |
| 81 search_controller_->OpenResult(result, event_flags); | |
| 82 } | |
| 83 | |
| 84 void AppListViewDelegate::InvokeSearchResultAction( | |
| 85 app_list::SearchResult* result, | |
| 86 int action_index, | |
| 87 int event_flags) { | |
| 88 if (search_controller_) | |
| 89 search_controller_->InvokeResultAction(result, action_index, event_flags); | |
| 90 } | |
| 91 | |
| 92 base::TimeDelta AppListViewDelegate::GetAutoLaunchTimeout() { | |
| 93 // Used by voice search, nothing needs to be done for now. | |
| 94 return base::TimeDelta(); | |
| 95 } | |
| 96 | |
| 97 void AppListViewDelegate::AutoLaunchCanceled() { | |
| 98 // Used by voice search, nothing needs to be done for now. | |
| 99 } | |
| 100 | |
| 101 void AppListViewDelegate::ViewInitialized() { | |
| 102 // Nothing needs to be done. | |
| 103 } | |
| 104 | |
| 105 void AppListViewDelegate::Dismiss() { | |
| 106 // Nothing needs to be done. | |
| 107 } | |
| 108 | |
| 109 void AppListViewDelegate::ViewClosing() { | |
| 110 // Nothing needs to be done. | |
| 111 } | |
| 112 | |
| 113 gfx::ImageSkia AppListViewDelegate::GetWindowIcon() { | |
| 114 return gfx::ImageSkia(); | |
| 115 } | |
| 116 | |
| 117 void AppListViewDelegate::OpenSettings() { | |
| 118 // Nothing needs to be done for now. | |
| 119 // TODO(mukai): should invoke the settings app. | |
| 120 } | |
| 121 | |
| 122 void AppListViewDelegate::OpenHelp() { | |
| 123 // Nothing needs to be done for now. | |
| 124 // TODO(mukai): should invoke the help app. | |
| 125 } | |
| 126 | |
| 127 void AppListViewDelegate::OpenFeedback() { | |
| 128 // Nothing needs to be done for now. | |
| 129 // TODO(mukai): should invoke the feedback app. | |
| 130 } | |
| 131 | |
| 132 void AppListViewDelegate::ToggleSpeechRecognition() { | |
| 133 // Nothing needs to be done. | |
| 134 } | |
| 135 | |
| 136 void AppListViewDelegate::ShowForProfileByPath( | |
| 137 const base::FilePath& profile_path) { | |
| 138 // Nothing needs to be done. | |
| 139 } | |
| 140 | |
| 141 views::View* AppListViewDelegate::CreateStartPageWebView( | |
| 142 const gfx::Size& size) { | |
| 143 return nullptr; | |
| 144 } | |
| 145 | |
| 146 std::vector<views::View*> AppListViewDelegate::CreateCustomPageWebViews( | |
| 147 const gfx::Size& size) { | |
| 148 return std::vector<views::View*>(); | |
| 149 } | |
| 150 | |
| 151 void AppListViewDelegate::CustomLauncherPageAnimationChanged(double progress) { | |
| 152 } | |
| 153 | |
| 154 void AppListViewDelegate::CustomLauncherPagePopSubpage() { | |
| 155 } | |
| 156 | |
| 157 bool AppListViewDelegate::IsSpeechRecognitionEnabled() { | |
| 158 return false; | |
| 159 } | |
| 160 | |
| 161 const app_list::AppListViewDelegate::Users& | |
| 162 AppListViewDelegate::GetUsers() const { | |
| 163 return users_; | |
| 164 } | |
| 165 | |
| 166 bool AppListViewDelegate::ShouldCenterWindow() const { | |
| 167 return true; | |
| 168 } | |
| 169 | |
| 170 } // namespace athena | |
| OLD | NEW |