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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 paint.setColor(SK_ColorWHITE); | 102 paint.setColor(SK_ColorWHITE); |
103 canvas->DrawRoundRect(GetContentsBounds(), corner_radius_, paint); | 103 canvas->DrawRoundRect(GetContentsBounds(), corner_radius_, paint); |
104 } | 104 } |
105 | 105 |
106 private: | 106 private: |
107 const int corner_radius_; | 107 const int corner_radius_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(AppListOverlayView); | 109 DISALLOW_COPY_AND_ASSIGN(AppListOverlayView); |
110 }; | 110 }; |
111 | 111 |
112 // An event targeter for the search box widget which will ignore events that | |
113 // are on the search box's shadow. | |
114 class SearchBoxWindowTargeter : public wm::MaskedWindowTargeter { | |
tapted
2015/02/03 23:56:31
this needs to be in USE_AURA as well. And wm::Mask
calamity
2015/02/04 03:37:01
Done.
| |
115 public: | |
116 SearchBoxWindowTargeter(aura::Window* window, views::View* content_view) | |
117 : wm::MaskedWindowTargeter(window), content_view_(content_view) {} | |
tapted
2015/02/03 23:56:31
nit: can you pass content_view->GetWidget()->GetNa
calamity
2015/02/04 03:37:01
Done.
| |
118 ~SearchBoxWindowTargeter() override {} | |
119 | |
120 private: | |
121 // wm::MaskedWindowTargeter: | |
122 bool GetHitTestMask(aura::Window* window, gfx::Path* mask) const override { | |
123 mask->addRect(gfx::RectToSkRect(content_view_->ConvertRectToWidget( | |
tapted
2015/02/03 23:56:31
Q: Is the ConvertRectToWidget bit needed (I only a
calamity
2015/02/04 03:37:01
Yeah, it can be removed.
| |
124 content_view_->GetContentsBounds()))); | |
125 return true; | |
126 } | |
127 | |
128 views::View* content_view_; | |
129 | |
130 DISALLOW_COPY_AND_ASSIGN(SearchBoxWindowTargeter); | |
131 }; | |
132 | |
112 } // namespace | 133 } // namespace |
113 | 134 |
114 // An animation observer to hide the view at the end of the animation. | 135 // An animation observer to hide the view at the end of the animation. |
115 class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { | 136 class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { |
116 public: | 137 public: |
117 HideViewAnimationObserver() | 138 HideViewAnimationObserver() |
118 : frame_(NULL), | 139 : frame_(NULL), |
119 target_(NULL) { | 140 target_(NULL) { |
120 } | 141 } |
121 | 142 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
419 search_box_widget_params.opacity = | 440 search_box_widget_params.opacity = |
420 views::Widget::InitParams::TRANSLUCENT_WINDOW; | 441 views::Widget::InitParams::TRANSLUCENT_WINDOW; |
421 | 442 |
422 // Create a widget for the SearchBoxView to live in. This allows the | 443 // Create a widget for the SearchBoxView to live in. This allows the |
423 // SearchBoxView to be on top of the custom launcher page's WebContents | 444 // SearchBoxView to be on top of the custom launcher page's WebContents |
424 // (otherwise the search box events will be captured by the WebContents). | 445 // (otherwise the search box events will be captured by the WebContents). |
425 search_box_widget_ = new views::Widget; | 446 search_box_widget_ = new views::Widget; |
426 search_box_widget_->Init(search_box_widget_params); | 447 search_box_widget_->Init(search_box_widget_params); |
427 search_box_widget_->SetContentsView(search_box_view_); | 448 search_box_widget_->SetContentsView(search_box_view_); |
428 | 449 |
450 #if defined(USE_AURA) | |
Matt Giuca
2015/02/03 07:29:23
Adding Trent to get opinion about this (as the res
| |
451 // Mouse events on the search box shadow should not be captured. | |
452 aura::Window* window = search_box_widget_->GetNativeWindow(); | |
453 window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | |
454 new SearchBoxWindowTargeter(window, search_box_view_))); | |
455 #endif | |
456 | |
429 app_list_main_view_->contents_view()->Layout(); | 457 app_list_main_view_->contents_view()->Layout(); |
430 } | 458 } |
431 | 459 |
432 void AppListView::InitAsBubbleInternal(gfx::NativeView parent, | 460 void AppListView::InitAsBubbleInternal(gfx::NativeView parent, |
433 int initial_apps_page, | 461 int initial_apps_page, |
434 views::BubbleBorder::Arrow arrow, | 462 views::BubbleBorder::Arrow arrow, |
435 bool border_accepts_events, | 463 bool border_accepts_events, |
436 const gfx::Vector2d& anchor_offset) { | 464 const gfx::Vector2d& anchor_offset) { |
437 // TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed. | 465 // TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed. |
438 tracked_objects::ScopedTracker tracking_profile1( | 466 tracked_objects::ScopedTracker tracking_profile1( |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 | 754 |
727 if (will_appear) { | 755 if (will_appear) { |
728 speech_view_->SetVisible(true); | 756 speech_view_->SetVisible(true); |
729 } else { | 757 } else { |
730 app_list_main_view_->SetVisible(true); | 758 app_list_main_view_->SetVisible(true); |
731 search_box_view_->search_box()->RequestFocus(); | 759 search_box_view_->search_box()->RequestFocus(); |
732 } | 760 } |
733 } | 761 } |
734 | 762 |
735 } // namespace app_list | 763 } // namespace app_list |
OLD | NEW |