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 <vector> | 6 #include <vector> |
7 | 7 |
8 #include "ash/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell/example_factory.h" | 10 #include "ash/shell/example_factory.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 Shell::GetInstance()->delegate()->GetActiveBrowserContext(), | 131 Shell::GetInstance()->delegate()->GetActiveBrowserContext(), |
132 NULL); | 132 NULL); |
133 break; | 133 break; |
134 } | 134 } |
135 default: | 135 default: |
136 break; | 136 break; |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 // AppListItem | 140 // AppListItem |
141 virtual void Activate(int event_flags) OVERRIDE { | 141 virtual void Activate(int event_flags) override { |
142 ActivateItem(type_, event_flags); | 142 ActivateItem(type_, event_flags); |
143 } | 143 } |
144 | 144 |
145 private: | 145 private: |
146 Type type_; | 146 Type type_; |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(WindowTypeShelfItem); | 148 DISALLOW_COPY_AND_ASSIGN(WindowTypeShelfItem); |
149 }; | 149 }; |
150 | 150 |
151 // ExampleSearchResult is an app list search result. It provides what icon to | 151 // ExampleSearchResult is an app list search result. It provides what icon to |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 return gfx::ImageSkia(canvas.ExtractImageRep()); | 229 return gfx::ImageSkia(canvas.ExtractImageRep()); |
230 } | 230 } |
231 | 231 |
232 void DecorateSearchBox(app_list::SearchBoxModel* search_box_model) { | 232 void DecorateSearchBox(app_list::SearchBoxModel* search_box_model) { |
233 search_box_model->SetIcon(CreateSearchBoxIcon()); | 233 search_box_model->SetIcon(CreateSearchBoxIcon()); |
234 search_box_model->SetHintText(base::ASCIIToUTF16("Type to search...")); | 234 search_box_model->SetHintText(base::ASCIIToUTF16("Type to search...")); |
235 } | 235 } |
236 | 236 |
237 // Overridden from app_list::AppListViewDelegate: | 237 // Overridden from app_list::AppListViewDelegate: |
238 virtual bool ForceNativeDesktop() const OVERRIDE { | 238 virtual bool ForceNativeDesktop() const override { |
239 return false; | 239 return false; |
240 } | 240 } |
241 | 241 |
242 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE { | 242 virtual void SetProfileByPath(const base::FilePath& profile_path) override { |
243 // Nothing needs to be done. | 243 // Nothing needs to be done. |
244 } | 244 } |
245 | 245 |
246 virtual const Users& GetUsers() const OVERRIDE { | 246 virtual const Users& GetUsers() const override { |
247 return users_; | 247 return users_; |
248 } | 248 } |
249 | 249 |
250 virtual bool ShouldCenterWindow() const OVERRIDE { | 250 virtual bool ShouldCenterWindow() const override { |
251 return false; | 251 return false; |
252 } | 252 } |
253 | 253 |
254 virtual app_list::AppListModel* GetModel() OVERRIDE { return model_.get(); } | 254 virtual app_list::AppListModel* GetModel() override { return model_.get(); } |
255 | 255 |
256 virtual app_list::SpeechUIModel* GetSpeechUI() OVERRIDE { | 256 virtual app_list::SpeechUIModel* GetSpeechUI() override { |
257 return &speech_ui_; | 257 return &speech_ui_; |
258 } | 258 } |
259 | 259 |
260 virtual void GetShortcutPathForApp( | 260 virtual void GetShortcutPathForApp( |
261 const std::string& app_id, | 261 const std::string& app_id, |
262 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE { | 262 const base::Callback<void(const base::FilePath&)>& callback) override { |
263 callback.Run(base::FilePath()); | 263 callback.Run(base::FilePath()); |
264 } | 264 } |
265 | 265 |
266 virtual void OpenSearchResult(app_list::SearchResult* result, | 266 virtual void OpenSearchResult(app_list::SearchResult* result, |
267 bool auto_launch, | 267 bool auto_launch, |
268 int event_flags) OVERRIDE { | 268 int event_flags) override { |
269 const ExampleSearchResult* example_result = | 269 const ExampleSearchResult* example_result = |
270 static_cast<const ExampleSearchResult*>(result); | 270 static_cast<const ExampleSearchResult*>(result); |
271 WindowTypeShelfItem::ActivateItem(example_result->type(), event_flags); | 271 WindowTypeShelfItem::ActivateItem(example_result->type(), event_flags); |
272 } | 272 } |
273 | 273 |
274 virtual void InvokeSearchResultAction(app_list::SearchResult* result, | 274 virtual void InvokeSearchResultAction(app_list::SearchResult* result, |
275 int action_index, | 275 int action_index, |
276 int event_flags) OVERRIDE { | 276 int event_flags) override { |
277 NOTIMPLEMENTED(); | 277 NOTIMPLEMENTED(); |
278 } | 278 } |
279 | 279 |
280 virtual base::TimeDelta GetAutoLaunchTimeout() OVERRIDE { | 280 virtual base::TimeDelta GetAutoLaunchTimeout() override { |
281 return base::TimeDelta(); | 281 return base::TimeDelta(); |
282 } | 282 } |
283 | 283 |
284 virtual void AutoLaunchCanceled() OVERRIDE { | 284 virtual void AutoLaunchCanceled() override { |
285 } | 285 } |
286 | 286 |
287 virtual void StartSearch() OVERRIDE { | 287 virtual void StartSearch() override { |
288 base::string16 query; | 288 base::string16 query; |
289 base::TrimWhitespace(model_->search_box()->text(), base::TRIM_ALL, &query); | 289 base::TrimWhitespace(model_->search_box()->text(), base::TRIM_ALL, &query); |
290 query = base::i18n::ToLower(query); | 290 query = base::i18n::ToLower(query); |
291 | 291 |
292 model_->results()->DeleteAll(); | 292 model_->results()->DeleteAll(); |
293 if (query.empty()) | 293 if (query.empty()) |
294 return; | 294 return; |
295 | 295 |
296 for (int i = 0; i < static_cast<int>(WindowTypeShelfItem::LAST_TYPE); ++i) { | 296 for (int i = 0; i < static_cast<int>(WindowTypeShelfItem::LAST_TYPE); ++i) { |
297 WindowTypeShelfItem::Type type = | 297 WindowTypeShelfItem::Type type = |
298 static_cast<WindowTypeShelfItem::Type>(i); | 298 static_cast<WindowTypeShelfItem::Type>(i); |
299 | 299 |
300 base::string16 title = | 300 base::string16 title = |
301 base::UTF8ToUTF16(WindowTypeShelfItem::GetTitle(type)); | 301 base::UTF8ToUTF16(WindowTypeShelfItem::GetTitle(type)); |
302 if (base::i18n::StringSearchIgnoringCaseAndAccents( | 302 if (base::i18n::StringSearchIgnoringCaseAndAccents( |
303 query, title, NULL, NULL)) { | 303 query, title, NULL, NULL)) { |
304 model_->results()->Add(new ExampleSearchResult(type, query)); | 304 model_->results()->Add(new ExampleSearchResult(type, query)); |
305 } | 305 } |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 virtual void StopSearch() OVERRIDE { | 309 virtual void StopSearch() override { |
310 // Nothing needs to be done. | 310 // Nothing needs to be done. |
311 } | 311 } |
312 | 312 |
313 virtual void ViewInitialized() OVERRIDE { | 313 virtual void ViewInitialized() override { |
314 // Nothing needs to be done. | 314 // Nothing needs to be done. |
315 } | 315 } |
316 | 316 |
317 virtual void Dismiss() OVERRIDE { | 317 virtual void Dismiss() override { |
318 DCHECK(ash::Shell::HasInstance()); | 318 DCHECK(ash::Shell::HasInstance()); |
319 Shell::GetInstance()->DismissAppList(); | 319 Shell::GetInstance()->DismissAppList(); |
320 } | 320 } |
321 | 321 |
322 virtual void ViewClosing() OVERRIDE { | 322 virtual void ViewClosing() override { |
323 // Nothing needs to be done. | 323 // Nothing needs to be done. |
324 } | 324 } |
325 | 325 |
326 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE { | 326 virtual gfx::ImageSkia GetWindowIcon() override { |
327 return gfx::ImageSkia(); | 327 return gfx::ImageSkia(); |
328 } | 328 } |
329 | 329 |
330 virtual void OpenSettings() OVERRIDE { | 330 virtual void OpenSettings() override { |
331 // Nothing needs to be done. | 331 // Nothing needs to be done. |
332 } | 332 } |
333 | 333 |
334 virtual void OpenHelp() OVERRIDE { | 334 virtual void OpenHelp() override { |
335 // Nothing needs to be done. | 335 // Nothing needs to be done. |
336 } | 336 } |
337 | 337 |
338 virtual void OpenFeedback() OVERRIDE { | 338 virtual void OpenFeedback() override { |
339 // Nothing needs to be done. | 339 // Nothing needs to be done. |
340 } | 340 } |
341 | 341 |
342 virtual void ToggleSpeechRecognition() OVERRIDE { | 342 virtual void ToggleSpeechRecognition() override { |
343 NOTIMPLEMENTED(); | 343 NOTIMPLEMENTED(); |
344 } | 344 } |
345 | 345 |
346 virtual void ShowForProfileByPath( | 346 virtual void ShowForProfileByPath( |
347 const base::FilePath& profile_path) OVERRIDE { | 347 const base::FilePath& profile_path) override { |
348 // Nothing needs to be done. | 348 // Nothing needs to be done. |
349 } | 349 } |
350 | 350 |
351 virtual views::View* CreateStartPageWebView(const gfx::Size& size) OVERRIDE { | 351 virtual views::View* CreateStartPageWebView(const gfx::Size& size) override { |
352 return NULL; | 352 return NULL; |
353 } | 353 } |
354 | 354 |
355 virtual std::vector<views::View*> CreateCustomPageWebViews( | 355 virtual std::vector<views::View*> CreateCustomPageWebViews( |
356 const gfx::Size& size) OVERRIDE { | 356 const gfx::Size& size) override { |
357 return std::vector<views::View*>(); | 357 return std::vector<views::View*>(); |
358 } | 358 } |
359 | 359 |
360 virtual bool IsSpeechRecognitionEnabled() OVERRIDE { | 360 virtual bool IsSpeechRecognitionEnabled() override { |
361 return false; | 361 return false; |
362 } | 362 } |
363 | 363 |
364 scoped_ptr<app_list::AppListModel> model_; | 364 scoped_ptr<app_list::AppListModel> model_; |
365 app_list::SpeechUIModel speech_ui_; | 365 app_list::SpeechUIModel speech_ui_; |
366 Users users_; | 366 Users users_; |
367 | 367 |
368 DISALLOW_COPY_AND_ASSIGN(ExampleAppListViewDelegate); | 368 DISALLOW_COPY_AND_ASSIGN(ExampleAppListViewDelegate); |
369 }; | 369 }; |
370 | 370 |
371 } // namespace | 371 } // namespace |
372 | 372 |
373 app_list::AppListViewDelegate* CreateAppListViewDelegate() { | 373 app_list::AppListViewDelegate* CreateAppListViewDelegate() { |
374 return new ExampleAppListViewDelegate; | 374 return new ExampleAppListViewDelegate; |
375 } | 375 } |
376 | 376 |
377 } // namespace shell | 377 } // namespace shell |
378 } // namespace ash | 378 } // namespace ash |
OLD | NEW |