Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: ui/app_list/views/app_list_view.cc

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 #include "ui/app_list/views/contents_view.h" 23 #include "ui/app_list/views/contents_view.h"
24 #include "ui/app_list/views/custom_launcher_page_view.h" 24 #include "ui/app_list/views/custom_launcher_page_view.h"
25 #include "ui/app_list/views/search_box_view.h" 25 #include "ui/app_list/views/search_box_view.h"
26 #include "ui/app_list/views/speech_view.h" 26 #include "ui/app_list/views/speech_view.h"
27 #include "ui/app_list/views/start_page_view.h" 27 #include "ui/app_list/views/start_page_view.h"
28 #include "ui/aura/window.h" 28 #include "ui/aura/window.h"
29 #include "ui/aura/window_tree_host.h" 29 #include "ui/aura/window_tree_host.h"
30 #include "ui/base/ui_base_switches.h" 30 #include "ui/base/ui_base_switches.h"
31 #include "ui/compositor/layer.h" 31 #include "ui/compositor/layer.h"
32 #include "ui/compositor/layer_animation_observer.h" 32 #include "ui/compositor/layer_animation_observer.h"
33 #include "ui/compositor/layer_type.h"
33 #include "ui/compositor/scoped_layer_animation_settings.h" 34 #include "ui/compositor/scoped_layer_animation_settings.h"
34 #include "ui/gfx/canvas.h" 35 #include "ui/gfx/canvas.h"
35 #include "ui/gfx/geometry/insets.h" 36 #include "ui/gfx/geometry/insets.h"
36 #include "ui/gfx/image/image_skia.h" 37 #include "ui/gfx/image/image_skia.h"
37 #include "ui/gfx/path.h" 38 #include "ui/gfx/path.h"
38 #include "ui/gfx/skia_util.h" 39 #include "ui/gfx/skia_util.h"
39 #include "ui/resources/grit/ui_resources.h" 40 #include "ui/resources/grit/ui_resources.h"
40 #include "ui/views/bubble/bubble_frame_view.h" 41 #include "ui/views/bubble/bubble_frame_view.h"
41 #include "ui/views/bubble/bubble_window_targeter.h" 42 #include "ui/views/bubble/bubble_window_targeter.h"
42 #include "ui/views/controls/image_view.h" 43 #include "ui/views/controls/image_view.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 80
80 DISALLOW_COPY_AND_ASSIGN(SearchBoxFocusHost); 81 DISALLOW_COPY_AND_ASSIGN(SearchBoxFocusHost);
81 }; 82 };
82 83
83 // The view for the App List overlay, which appears as a white rounded 84 // The view for the App List overlay, which appears as a white rounded
84 // rectangle with the given radius. 85 // rectangle with the given radius.
85 class AppListOverlayView : public views::View { 86 class AppListOverlayView : public views::View {
86 public: 87 public:
87 explicit AppListOverlayView(int corner_radius) 88 explicit AppListOverlayView(int corner_radius)
88 : corner_radius_(corner_radius) { 89 : corner_radius_(corner_radius) {
89 SetPaintToLayer(true); 90 SetPaintToLayer(ui::LAYER_TEXTURED);
90 SetVisible(false); 91 SetVisible(false);
91 layer()->SetOpacity(0.0f); 92 layer()->SetOpacity(0.0f);
92 } 93 }
93 94
94 ~AppListOverlayView() override {} 95 ~AppListOverlayView() override {}
95 96
96 // Overridden from views::View: 97 // Overridden from views::View:
97 void OnPaint(gfx::Canvas* canvas) override { 98 void OnPaint(gfx::Canvas* canvas) override {
98 SkPaint paint; 99 SkPaint paint;
99 paint.setStyle(SkPaint::kFill_Style); 100 paint.setStyle(SkPaint::kFill_Style);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 362
362 void AppListView::InitContents(gfx::NativeView parent, int initial_apps_page) { 363 void AppListView::InitContents(gfx::NativeView parent, int initial_apps_page) {
363 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and 364 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and
364 // crbug.com/441028 are fixed. 365 // crbug.com/441028 are fixed.
365 tracked_objects::ScopedTracker tracking_profile( 366 tracked_objects::ScopedTracker tracking_profile(
366 FROM_HERE_WITH_EXPLICIT_FUNCTION( 367 FROM_HERE_WITH_EXPLICIT_FUNCTION(
367 "440224, 441028 AppListView::InitContents")); 368 "440224, 441028 AppListView::InitContents"));
368 369
369 app_list_main_view_ = new AppListMainView(delegate_); 370 app_list_main_view_ = new AppListMainView(delegate_);
370 AddChildView(app_list_main_view_); 371 AddChildView(app_list_main_view_);
371 app_list_main_view_->SetPaintToLayer(true); 372 app_list_main_view_->SetPaintToLayer(ui::LAYER_TEXTURED);
372 app_list_main_view_->layer()->SetFillsBoundsOpaquely(false); 373 app_list_main_view_->layer()->SetFillsBoundsOpaquely(false);
373 app_list_main_view_->layer()->SetMasksToBounds(true); 374 app_list_main_view_->layer()->SetMasksToBounds(true);
374 375
375 // This will be added to the |search_box_widget_| after the app list widget is 376 // This will be added to the |search_box_widget_| after the app list widget is
376 // initialized. 377 // initialized.
377 search_box_view_ = new SearchBoxView(app_list_main_view_, delegate_); 378 search_box_view_ = new SearchBoxView(app_list_main_view_, delegate_);
378 search_box_view_->SetPaintToLayer(true); 379 search_box_view_->SetPaintToLayer(ui::LAYER_TEXTURED);
379 search_box_view_->layer()->SetFillsBoundsOpaquely(false); 380 search_box_view_->layer()->SetFillsBoundsOpaquely(false);
380 search_box_view_->layer()->SetMasksToBounds(true); 381 search_box_view_->layer()->SetMasksToBounds(true);
381 382
382 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and 383 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and
383 // crbug.com/441028 are fixed. 384 // crbug.com/441028 are fixed.
384 tracked_objects::ScopedTracker tracking_profile1( 385 tracked_objects::ScopedTracker tracking_profile1(
385 FROM_HERE_WITH_EXPLICIT_FUNCTION( 386 FROM_HERE_WITH_EXPLICIT_FUNCTION(
386 "440224, 441028 AppListView::InitContents1")); 387 "440224, 441028 AppListView::InitContents1"));
387 388
388 app_list_main_view_->Init(parent, initial_apps_page, search_box_view_); 389 app_list_main_view_->Init(parent, initial_apps_page, search_box_view_);
389 390
390 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and 391 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440224 and
391 // crbug.com/441028 are fixed. 392 // crbug.com/441028 are fixed.
392 tracked_objects::ScopedTracker tracking_profile2( 393 tracked_objects::ScopedTracker tracking_profile2(
393 FROM_HERE_WITH_EXPLICIT_FUNCTION( 394 FROM_HERE_WITH_EXPLICIT_FUNCTION(
394 "440224, 441028 AppListView::InitContents2")); 395 "440224, 441028 AppListView::InitContents2"));
395 396
396 // Speech recognition is available only when the start page exists. 397 // Speech recognition is available only when the start page exists.
397 if (delegate_ && delegate_->IsSpeechRecognitionEnabled()) { 398 if (delegate_ && delegate_->IsSpeechRecognitionEnabled()) {
398 speech_view_ = new SpeechView(delegate_); 399 speech_view_ = new SpeechView(delegate_);
399 speech_view_->SetVisible(false); 400 speech_view_->SetVisible(false);
400 speech_view_->SetPaintToLayer(true); 401 speech_view_->SetPaintToLayer(ui::LAYER_TEXTURED);
401 speech_view_->layer()->SetFillsBoundsOpaquely(false); 402 speech_view_->layer()->SetFillsBoundsOpaquely(false);
402 speech_view_->layer()->SetOpacity(0.0f); 403 speech_view_->layer()->SetOpacity(0.0f);
403 AddChildView(speech_view_); 404 AddChildView(speech_view_);
404 } 405 }
405 } 406 }
406 407
407 void AppListView::InitChildWidgets() { 408 void AppListView::InitChildWidgets() {
408 DCHECK(search_box_view_); 409 DCHECK(search_box_view_);
409 410
410 // Create the search box widget. 411 // Create the search box widget.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 app_list_main_view_->SetVisible(true); 596 app_list_main_view_->SetVisible(true);
596 // Refocus the search box. However, if the app list widget does not have 597 // 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* 598 // 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). 599 // focus the search box (or we would steal focus back into the app list).
599 if (GetWidget()->IsActive()) 600 if (GetWidget()->IsActive())
600 search_box_view_->search_box()->RequestFocus(); 601 search_box_view_->search_box()->RequestFocus();
601 } 602 }
602 } 603 }
603 604
604 } // namespace app_list 605 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698