| 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 "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(SearchBoxFocusHost); | 80 DISALLOW_COPY_AND_ASSIGN(SearchBoxFocusHost); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 // The view for the App List overlay, which appears as a white rounded | 83 // The view for the App List overlay, which appears as a white rounded |
| 84 // rectangle with the given radius. | 84 // rectangle with the given radius. |
| 85 class AppListOverlayView : public views::View { | 85 class AppListOverlayView : public views::View { |
| 86 public: | 86 public: |
| 87 explicit AppListOverlayView(int corner_radius) | 87 explicit AppListOverlayView(int corner_radius) |
| 88 : corner_radius_(corner_radius) { | 88 : corner_radius_(corner_radius) { |
| 89 SetPaintToLayer(true); | 89 SetPaintToLayer(); |
| 90 SetVisible(false); | 90 SetVisible(false); |
| 91 layer()->SetOpacity(0.0f); | 91 layer()->SetOpacity(0.0f); |
| 92 } | 92 } |
| 93 | 93 |
| 94 ~AppListOverlayView() override {} | 94 ~AppListOverlayView() override {} |
| 95 | 95 |
| 96 // Overridden from views::View: | 96 // Overridden from views::View: |
| 97 void OnPaint(gfx::Canvas* canvas) override { | 97 void OnPaint(gfx::Canvas* canvas) override { |
| 98 SkPaint paint; | 98 SkPaint paint; |
| 99 paint.setStyle(SkPaint::kFill_Style); | 99 paint.setStyle(SkPaint::kFill_Style); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 361 |
| 362 void AppListView::InitContents(gfx::NativeView parent, int initial_apps_page) { | 362 void AppListView::InitContents(gfx::NativeView parent, int initial_apps_page) { |
| 363 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and | 363 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and |
| 364 // crbug.com/441028 are fixed. | 364 // crbug.com/441028 are fixed. |
| 365 tracked_objects::ScopedTracker tracking_profile( | 365 tracked_objects::ScopedTracker tracking_profile( |
| 366 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 366 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 367 "440224, 441028 AppListView::InitContents")); | 367 "440224, 441028 AppListView::InitContents")); |
| 368 | 368 |
| 369 app_list_main_view_ = new AppListMainView(delegate_); | 369 app_list_main_view_ = new AppListMainView(delegate_); |
| 370 AddChildView(app_list_main_view_); | 370 AddChildView(app_list_main_view_); |
| 371 app_list_main_view_->SetPaintToLayer(true); | 371 app_list_main_view_->SetPaintToLayer(); |
| 372 app_list_main_view_->layer()->SetFillsBoundsOpaquely(false); | 372 app_list_main_view_->layer()->SetFillsBoundsOpaquely(false); |
| 373 app_list_main_view_->layer()->SetMasksToBounds(true); | 373 app_list_main_view_->layer()->SetMasksToBounds(true); |
| 374 | 374 |
| 375 // This will be added to the |search_box_widget_| after the app list widget is | 375 // This will be added to the |search_box_widget_| after the app list widget is |
| 376 // initialized. | 376 // initialized. |
| 377 search_box_view_ = new SearchBoxView(app_list_main_view_, delegate_); | 377 search_box_view_ = new SearchBoxView(app_list_main_view_, delegate_); |
| 378 search_box_view_->SetPaintToLayer(true); | 378 search_box_view_->SetPaintToLayer(); |
| 379 search_box_view_->layer()->SetFillsBoundsOpaquely(false); | 379 search_box_view_->layer()->SetFillsBoundsOpaquely(false); |
| 380 search_box_view_->layer()->SetMasksToBounds(true); | 380 search_box_view_->layer()->SetMasksToBounds(true); |
| 381 | 381 |
| 382 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and | 382 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and |
| 383 // crbug.com/441028 are fixed. | 383 // crbug.com/441028 are fixed. |
| 384 tracked_objects::ScopedTracker tracking_profile1( | 384 tracked_objects::ScopedTracker tracking_profile1( |
| 385 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 385 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 386 "440224, 441028 AppListView::InitContents1")); | 386 "440224, 441028 AppListView::InitContents1")); |
| 387 | 387 |
| 388 app_list_main_view_->Init(parent, initial_apps_page, search_box_view_); | 388 app_list_main_view_->Init(parent, initial_apps_page, search_box_view_); |
| 389 | 389 |
| 390 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and | 390 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and |
| 391 // crbug.com/441028 are fixed. | 391 // crbug.com/441028 are fixed. |
| 392 tracked_objects::ScopedTracker tracking_profile2( | 392 tracked_objects::ScopedTracker tracking_profile2( |
| 393 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 393 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 394 "440224, 441028 AppListView::InitContents2")); | 394 "440224, 441028 AppListView::InitContents2")); |
| 395 | 395 |
| 396 // Speech recognition is available only when the start page exists. | 396 // Speech recognition is available only when the start page exists. |
| 397 if (delegate_ && delegate_->IsSpeechRecognitionEnabled()) { | 397 if (delegate_ && delegate_->IsSpeechRecognitionEnabled()) { |
| 398 speech_view_ = new SpeechView(delegate_); | 398 speech_view_ = new SpeechView(delegate_); |
| 399 speech_view_->SetVisible(false); | 399 speech_view_->SetVisible(false); |
| 400 speech_view_->SetPaintToLayer(true); | 400 speech_view_->SetPaintToLayer(); |
| 401 speech_view_->layer()->SetFillsBoundsOpaquely(false); | 401 speech_view_->layer()->SetFillsBoundsOpaquely(false); |
| 402 speech_view_->layer()->SetOpacity(0.0f); | 402 speech_view_->layer()->SetOpacity(0.0f); |
| 403 AddChildView(speech_view_); | 403 AddChildView(speech_view_); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 void AppListView::InitChildWidgets() { | 407 void AppListView::InitChildWidgets() { |
| 408 DCHECK(search_box_view_); | 408 DCHECK(search_box_view_); |
| 409 | 409 |
| 410 // Create the search box widget. | 410 // Create the search box widget. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 app_list_main_view_->SetVisible(true); | 595 app_list_main_view_->SetVisible(true); |
| 596 // Refocus the search box. However, if the app list widget does not have | 596 // Refocus the search box. However, if the app list widget does not have |
| 597 // focus, it means another window has already taken focus, and we *must not* | 597 // focus, it means another window has already taken focus, and we *must not* |
| 598 // focus the search box (or we would steal focus back into the app list). | 598 // focus the search box (or we would steal focus back into the app list). |
| 599 if (GetWidget()->IsActive()) | 599 if (GetWidget()->IsActive()) |
| 600 search_box_view_->search_box()->RequestFocus(); | 600 search_box_view_->search_box()->RequestFocus(); |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 | 603 |
| 604 } // namespace app_list | 604 } // namespace app_list |
| OLD | NEW |