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 gfx::Size size_; | |
oshima
2014/08/07 06:37:48
const
Jun Mukai
2014/08/07 20:14:34
Done.
| |
45 }; | |
oshima
2014/08/07 06:37:48
disallow_copy_and_assign
Jun Mukai
2014/08/07 20:14:34
Done.
| |
46 | |
47 } | |
48 | |
25 AppListViewDelegate::AppListViewDelegate(AppModelBuilder* model_builder) | 49 AppListViewDelegate::AppListViewDelegate(AppModelBuilder* model_builder) |
26 : model_(new app_list::AppListModel), | 50 : model_(new app_list::AppListModel), |
27 speech_ui_(new app_list::SpeechUIModel( | 51 speech_ui_(new app_list::SpeechUIModel( |
28 app_list::SPEECH_RECOGNITION_OFF)) { | 52 app_list::SPEECH_RECOGNITION_OFF)) { |
29 model_builder->PopulateApps(model_.get()); | 53 model_builder->PopulateApps(model_.get()); |
30 // TODO(mukai): get the text from the resources. | 54 // TODO(mukai): get the text from the resources. |
31 model_->search_box()->SetHintText(base::ASCIIToUTF16("Search")); | 55 model_->search_box()->SetHintText(base::ASCIIToUTF16("Search")); |
32 } | 56 } |
33 | 57 |
34 AppListViewDelegate::~AppListViewDelegate() { | 58 AppListViewDelegate::~AppListViewDelegate() { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 // Nothing needs to be done. | 172 // Nothing needs to be done. |
149 } | 173 } |
150 | 174 |
151 void AppListViewDelegate::ShowForProfileByPath( | 175 void AppListViewDelegate::ShowForProfileByPath( |
152 const base::FilePath& profile_path) { | 176 const base::FilePath& profile_path) { |
153 // Nothing needs to be done. | 177 // Nothing needs to be done. |
154 } | 178 } |
155 | 179 |
156 views::View* AppListViewDelegate::CreateStartPageWebView( | 180 views::View* AppListViewDelegate::CreateStartPageWebView( |
157 const gfx::Size& size) { | 181 const gfx::Size& size) { |
158 return NULL; | 182 return new DummyLogoView(size); |
159 } | 183 } |
160 | 184 |
161 views::View* AppListViewDelegate::CreateCustomPageWebView( | 185 views::View* AppListViewDelegate::CreateCustomPageWebView( |
162 const gfx::Size& size) { | 186 const gfx::Size& size) { |
163 return NULL; | 187 return NULL; |
164 } | 188 } |
165 | 189 |
166 bool AppListViewDelegate::IsSpeechRecognitionEnabled() { | 190 bool AppListViewDelegate::IsSpeechRecognitionEnabled() { |
167 return false; | 191 return false; |
168 } | 192 } |
169 | 193 |
170 const app_list::AppListViewDelegate::Users& | 194 const app_list::AppListViewDelegate::Users& |
171 AppListViewDelegate::GetUsers() const { | 195 AppListViewDelegate::GetUsers() const { |
172 return users_; | 196 return users_; |
173 } | 197 } |
174 | 198 |
175 bool AppListViewDelegate::ShouldCenterWindow() const { | 199 bool AppListViewDelegate::ShouldCenterWindow() const { |
176 return true; | 200 return true; |
177 } | 201 } |
178 | 202 |
179 } // namespace athena | 203 } // namespace athena |
OLD | NEW |