Chromium Code Reviews| Index: ui/app_list/views/app_list_view.cc |
| diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc |
| index c10c3d2d0e45062925aa26014362060028746ddb..f066057c32c940906de9034381f12377b6ab6a71 100644 |
| --- a/ui/app_list/views/app_list_view.cc |
| +++ b/ui/app_list/views/app_list_view.cc |
| @@ -157,8 +157,9 @@ class HideViewAnimationObserver : public ui::ImplicitAnimationObserver { |
| AppListView::AppListView(AppListViewDelegate* delegate) |
| : delegate_(delegate), |
| app_list_main_view_(NULL), |
| - search_box_view_(NULL), |
| speech_view_(NULL), |
|
Matt Giuca
2014/12/02 07:55:14
nullptr all these.
calamity
2014/12/03 03:31:26
Done.
|
| + search_box_widget_(NULL), |
| + search_box_view_(NULL), |
| experimental_banner_view_(NULL), |
| overlay_view_(NULL), |
| animation_observer_(new HideViewAnimationObserver()) { |
| @@ -219,6 +220,8 @@ void AppListView::InitAsFramelessWindow(gfx::NativeView parent, |
| // View::AddChildView() which is called at Widget::SetContentsView() to build |
| // the views hierarchy in the widget. |
| set_background(new AppListBackground(0, app_list_main_view_)); |
| + |
| + InitChildWidgets(); |
| } |
| void AppListView::SetBubbleArrow(views::BubbleBorder::Arrow arrow) { |
| @@ -355,11 +358,12 @@ void AppListView::InitContents(gfx::NativeView parent, int initial_apps_page) { |
| app_list_main_view_->SetFillsBoundsOpaquely(false); |
| app_list_main_view_->layer()->SetMasksToBounds(true); |
| + // This will be added to the |search_box_widget_| after the app list widget is |
| + // initialized. |
| search_box_view_ = new SearchBoxView(app_list_main_view_, delegate_); |
| search_box_view_->SetPaintToLayer(true); |
| search_box_view_->SetFillsBoundsOpaquely(false); |
| search_box_view_->layer()->SetMasksToBounds(true); |
| - AddChildView(search_box_view_); |
| app_list_main_view_->Init(parent, initial_apps_page, search_box_view_); |
| @@ -388,6 +392,28 @@ void AppListView::InitContents(gfx::NativeView parent, int initial_apps_page) { |
| OnProfilesChanged(); |
| } |
| +void AppListView::InitChildWidgets() { |
| + DCHECK(search_box_view_); |
| + |
| + app_list_main_view_->InitWidgets(); |
| + |
| + // Create the search box widget. |
| + views::Widget::InitParams search_box_widget_params( |
| + views::Widget::InitParams::TYPE_CONTROL); |
| + search_box_widget_params.parent = GetWidget()->GetNativeView(); |
| + search_box_widget_params.opacity = |
| + views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| + |
| + // Create a widget for the SearchBoxView to live in. This widget allows the |
| + // SearchBoxView to receive events before the custom launcher page's |
|
Matt Giuca
2014/12/02 07:55:14
I don't really think of it as "before / after", ra
calamity
2014/12/03 03:31:26
Done.
|
| + // WebContents. |
| + search_box_widget_ = new views::Widget; |
| + search_box_widget_->Init(search_box_widget_params); |
| + search_box_widget_->SetContentsView(search_box_view_); |
| + |
| + Layout(); |
| +} |
| + |
| void AppListView::InitAsBubbleInternal(gfx::NativeView parent, |
| int initial_apps_page, |
| views::BubbleBorder::Arrow arrow, |
| @@ -425,7 +451,7 @@ void AppListView::InitAsBubbleInternal(gfx::NativeView parent, |
| SetBubbleArrow(arrow); |
| // We can now create the internal widgets. |
| - app_list_main_view_->InitWidgets(); |
| + InitChildWidgets(); |
| #if defined(USE_AURA) |
| // TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed. |
| @@ -576,7 +602,10 @@ void AppListView::Layout() { |
| // in STATE_START. |
| gfx::RectF search_box_bounds = contents_view->GetDefaultSearchBoxBounds(); |
| ConvertRectToTarget(contents_view, this, &search_box_bounds); |
| - search_box_view_->SetBoundsRect(gfx::ToNearestRect(search_box_bounds)); |
| + if (search_box_widget_) { |
|
Matt Giuca
2014/12/02 07:55:14
Just checking: Can this be a DCHECK or are there s
calamity
2014/12/03 03:31:26
It's null on initial layout unfortunately. This is
|
| + search_box_widget_->SetBounds( |
| + ConvertRectToWidget(gfx::ToNearestRect(search_box_bounds))); |
| + } |
| if (speech_view_) { |
| gfx::Rect speech_bounds = centered_bounds; |