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