| 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 <memory> |
| 5 #include <string> | 6 #include <string> |
| 6 #include <utility> | 7 #include <utility> |
| 7 #include <vector> | 8 #include <vector> |
| 8 | 9 |
| 9 #include "ash/session/session_state_delegate.h" | 10 #include "ash/session/session_state_delegate.h" |
| 10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 11 #include "ash/shell/example_factory.h" | 12 #include "ash/shell/example_factory.h" |
| 12 #include "ash/shell/toplevel_window.h" | 13 #include "ash/shell/toplevel_window.h" |
| 13 #include "ash/shell_delegate.h" | 14 #include "ash/shell_delegate.h" |
| 14 #include "base/callback.h" | 15 #include "base/callback.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 Shell::GetInstance()->session_state_delegate()->LockScreen(); | 119 Shell::GetInstance()->session_state_delegate()->LockScreen(); |
| 119 break; | 120 break; |
| 120 } | 121 } |
| 121 case WIDGETS_WINDOW: { | 122 case WIDGETS_WINDOW: { |
| 122 CreateWidgetsWindow(); | 123 CreateWidgetsWindow(); |
| 123 break; | 124 break; |
| 124 } | 125 } |
| 125 case EXAMPLES_WINDOW: { | 126 case EXAMPLES_WINDOW: { |
| 126 views::examples::ShowExamplesWindow( | 127 views::examples::ShowExamplesWindow( |
| 127 views::examples::QUIT_ON_CLOSE, NULL, | 128 views::examples::QUIT_ON_CLOSE, NULL, |
| 128 scoped_ptr<ScopedVector<views::examples::ExampleBase>>()); | 129 std::unique_ptr<ScopedVector<views::examples::ExampleBase>>()); |
| 129 break; | 130 break; |
| 130 } | 131 } |
| 131 default: | 132 default: |
| 132 break; | 133 break; |
| 133 } | 134 } |
| 134 } | 135 } |
| 135 | 136 |
| 136 // AppListItem | 137 // AppListItem |
| 137 void Activate(int event_flags) override { ActivateItem(type_, event_flags); } | 138 void Activate(int event_flags) override { ActivateItem(type_, event_flags); } |
| 138 | 139 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 base::UTF8ToUTF16(WindowTypeShelfItem::GetDetails(type_)); | 187 base::UTF8ToUTF16(WindowTypeShelfItem::GetDetails(type_)); |
| 187 set_details(details); | 188 set_details(details); |
| 188 Tags details_tags; | 189 Tags details_tags; |
| 189 details_tags.push_back(Tag(Tag::DIM, 0, details.length())); | 190 details_tags.push_back(Tag(Tag::DIM, 0, details.length())); |
| 190 set_details_tags(details_tags); | 191 set_details_tags(details_tags); |
| 191 } | 192 } |
| 192 | 193 |
| 193 WindowTypeShelfItem::Type type() const { return type_; } | 194 WindowTypeShelfItem::Type type() const { return type_; } |
| 194 | 195 |
| 195 // app_list::SearchResult: | 196 // app_list::SearchResult: |
| 196 scoped_ptr<SearchResult> Duplicate() const override { | 197 std::unique_ptr<SearchResult> Duplicate() const override { |
| 197 return scoped_ptr<SearchResult>(); | 198 return std::unique_ptr<SearchResult>(); |
| 198 } | 199 } |
| 199 | 200 |
| 200 private: | 201 private: |
| 201 WindowTypeShelfItem::Type type_; | 202 WindowTypeShelfItem::Type type_; |
| 202 | 203 |
| 203 DISALLOW_COPY_AND_ASSIGN(ExampleSearchResult); | 204 DISALLOW_COPY_AND_ASSIGN(ExampleSearchResult); |
| 204 }; | 205 }; |
| 205 | 206 |
| 206 class ExampleAppListViewDelegate : public app_list::AppListViewDelegate { | 207 class ExampleAppListViewDelegate : public app_list::AppListViewDelegate { |
| 207 public: | 208 public: |
| 208 ExampleAppListViewDelegate() | 209 ExampleAppListViewDelegate() |
| 209 : model_(new app_list::AppListModel) { | 210 : model_(new app_list::AppListModel) { |
| 210 PopulateApps(); | 211 PopulateApps(); |
| 211 DecorateSearchBox(model_->search_box()); | 212 DecorateSearchBox(model_->search_box()); |
| 212 } | 213 } |
| 213 | 214 |
| 214 private: | 215 private: |
| 215 void PopulateApps() { | 216 void PopulateApps() { |
| 216 for (int i = 0; i < static_cast<int>(WindowTypeShelfItem::LAST_TYPE); ++i) { | 217 for (int i = 0; i < static_cast<int>(WindowTypeShelfItem::LAST_TYPE); ++i) { |
| 217 WindowTypeShelfItem::Type type = | 218 WindowTypeShelfItem::Type type = |
| 218 static_cast<WindowTypeShelfItem::Type>(i); | 219 static_cast<WindowTypeShelfItem::Type>(i); |
| 219 std::string id = base::IntToString(i); | 220 std::string id = base::IntToString(i); |
| 220 scoped_ptr<WindowTypeShelfItem> shelf_item( | 221 std::unique_ptr<WindowTypeShelfItem> shelf_item( |
| 221 new WindowTypeShelfItem(id, type)); | 222 new WindowTypeShelfItem(id, type)); |
| 222 model_->AddItem(std::move(shelf_item)); | 223 model_->AddItem(std::move(shelf_item)); |
| 223 } | 224 } |
| 224 } | 225 } |
| 225 | 226 |
| 226 gfx::ImageSkia CreateSearchBoxIcon() { | 227 gfx::ImageSkia CreateSearchBoxIcon() { |
| 227 const base::string16 icon_text = base::ASCIIToUTF16("ash"); | 228 const base::string16 icon_text = base::ASCIIToUTF16("ash"); |
| 228 const gfx::Size icon_size(32, 32); | 229 const gfx::Size icon_size(32, 32); |
| 229 | 230 |
| 230 gfx::Canvas canvas(icon_size, 1.0f, false /* is_opaque */); | 231 gfx::Canvas canvas(icon_size, 1.0f, false /* is_opaque */); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 const gfx::Size& size) override { | 351 const gfx::Size& size) override { |
| 351 return std::vector<views::View*>(); | 352 return std::vector<views::View*>(); |
| 352 } | 353 } |
| 353 | 354 |
| 354 void CustomLauncherPageAnimationChanged(double progress) override {} | 355 void CustomLauncherPageAnimationChanged(double progress) override {} |
| 355 | 356 |
| 356 void CustomLauncherPagePopSubpage() override {} | 357 void CustomLauncherPagePopSubpage() override {} |
| 357 | 358 |
| 358 bool IsSpeechRecognitionEnabled() override { return false; } | 359 bool IsSpeechRecognitionEnabled() override { return false; } |
| 359 | 360 |
| 360 scoped_ptr<app_list::AppListModel> model_; | 361 std::unique_ptr<app_list::AppListModel> model_; |
| 361 app_list::SpeechUIModel speech_ui_; | 362 app_list::SpeechUIModel speech_ui_; |
| 362 Users users_; | 363 Users users_; |
| 363 | 364 |
| 364 DISALLOW_COPY_AND_ASSIGN(ExampleAppListViewDelegate); | 365 DISALLOW_COPY_AND_ASSIGN(ExampleAppListViewDelegate); |
| 365 }; | 366 }; |
| 366 | 367 |
| 367 } // namespace | 368 } // namespace |
| 368 | 369 |
| 369 app_list::AppListViewDelegate* CreateAppListViewDelegate() { | 370 app_list::AppListViewDelegate* CreateAppListViewDelegate() { |
| 370 return new ExampleAppListViewDelegate; | 371 return new ExampleAppListViewDelegate; |
| 371 } | 372 } |
| 372 | 373 |
| 373 } // namespace shell | 374 } // namespace shell |
| 374 } // namespace ash | 375 } // namespace ash |
| OLD | NEW |