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