OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "athena/home/app_list_view_delegate.h" | 5 #include "athena/home/app_list_view_delegate.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "athena/home/public/app_model_builder.h" | 9 #include "athena/home/public/app_model_builder.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
16 #include "ui/app_list/app_list_model.h" | 16 #include "ui/app_list/app_list_model.h" |
17 #include "ui/app_list/search_box_model.h" | 17 #include "ui/app_list/search_box_model.h" |
18 #include "ui/app_list/search_provider.h" | 18 #include "ui/app_list/search_provider.h" |
19 #include "ui/app_list/search_result.h" | 19 #include "ui/app_list/search_result.h" |
20 #include "ui/app_list/speech_ui_model.h" | 20 #include "ui/app_list/speech_ui_model.h" |
21 #include "ui/gfx/image/image_skia.h" | 21 #include "ui/gfx/image/image_skia.h" |
| 22 #include "ui/views/background.h" |
| 23 #include "ui/views/view.h" |
22 | 24 |
23 namespace athena { | 25 namespace athena { |
24 | 26 |
| 27 namespace { |
| 28 |
| 29 // A view to draw the logo area of app-list centered view. |
| 30 // TODO(mukai): replace this by the actual start page webview. |
| 31 class DummyLogoView : public views::View { |
| 32 public: |
| 33 explicit DummyLogoView(const gfx::Size& size) |
| 34 : size_(size) { |
| 35 set_background(views::Background::CreateSolidBackground( |
| 36 SK_ColorLTGRAY)); |
| 37 } |
| 38 |
| 39 private: |
| 40 virtual gfx::Size GetPreferredSize() const OVERRIDE { |
| 41 return size_; |
| 42 } |
| 43 |
| 44 const gfx::Size size_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(DummyLogoView); |
| 47 }; |
| 48 |
| 49 } |
| 50 |
25 AppListViewDelegate::AppListViewDelegate(AppModelBuilder* model_builder) | 51 AppListViewDelegate::AppListViewDelegate(AppModelBuilder* model_builder) |
26 : model_(new app_list::AppListModel), | 52 : model_(new app_list::AppListModel), |
27 speech_ui_(new app_list::SpeechUIModel( | 53 speech_ui_(new app_list::SpeechUIModel( |
28 app_list::SPEECH_RECOGNITION_OFF)) { | 54 app_list::SPEECH_RECOGNITION_OFF)) { |
29 model_builder->PopulateApps(model_.get()); | 55 model_builder->PopulateApps(model_.get()); |
30 // TODO(mukai): get the text from the resources. | 56 // TODO(mukai): get the text from the resources. |
31 model_->search_box()->SetHintText(base::ASCIIToUTF16("Search")); | 57 model_->search_box()->SetHintText(base::ASCIIToUTF16("Search")); |
32 } | 58 } |
33 | 59 |
34 AppListViewDelegate::~AppListViewDelegate() { | 60 AppListViewDelegate::~AppListViewDelegate() { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // Nothing needs to be done. | 174 // Nothing needs to be done. |
149 } | 175 } |
150 | 176 |
151 void AppListViewDelegate::ShowForProfileByPath( | 177 void AppListViewDelegate::ShowForProfileByPath( |
152 const base::FilePath& profile_path) { | 178 const base::FilePath& profile_path) { |
153 // Nothing needs to be done. | 179 // Nothing needs to be done. |
154 } | 180 } |
155 | 181 |
156 views::View* AppListViewDelegate::CreateStartPageWebView( | 182 views::View* AppListViewDelegate::CreateStartPageWebView( |
157 const gfx::Size& size) { | 183 const gfx::Size& size) { |
158 return NULL; | 184 return new DummyLogoView(size); |
159 } | 185 } |
160 | 186 |
161 views::View* AppListViewDelegate::CreateCustomPageWebView( | 187 views::View* AppListViewDelegate::CreateCustomPageWebView( |
162 const gfx::Size& size) { | 188 const gfx::Size& size) { |
163 return NULL; | 189 return NULL; |
164 } | 190 } |
165 | 191 |
166 bool AppListViewDelegate::IsSpeechRecognitionEnabled() { | 192 bool AppListViewDelegate::IsSpeechRecognitionEnabled() { |
167 return false; | 193 return false; |
168 } | 194 } |
169 | 195 |
170 const app_list::AppListViewDelegate::Users& | 196 const app_list::AppListViewDelegate::Users& |
171 AppListViewDelegate::GetUsers() const { | 197 AppListViewDelegate::GetUsers() const { |
172 return users_; | 198 return users_; |
173 } | 199 } |
174 | 200 |
175 bool AppListViewDelegate::ShouldCenterWindow() const { | 201 bool AppListViewDelegate::ShouldCenterWindow() const { |
176 return true; | 202 return true; |
177 } | 203 } |
178 | 204 |
179 } // namespace athena | 205 } // namespace athena |
OLD | NEW |