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 2a1be91f97cb2a39c98e458b0cd518b89c0b5d5e..0173b6fa2bc412ee56c0812fd6abb76b3f4747a1 100644 |
| --- a/ui/app_list/views/app_list_view.cc |
| +++ b/ui/app_list/views/app_list_view.cc |
| @@ -124,6 +124,12 @@ class SearchBoxWindowTargeter : public wm::MaskedWindowTargeter { |
| DISALLOW_COPY_AND_ASSIGN(SearchBoxWindowTargeter); |
| }; |
| +// Checks to see if the fullscreen app list has been enabled via cmd line switch |
| +bool IsFullscreenAppListEnabled() { |
| + return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnableFullscreenAppList); |
| + } |
|
newcomer
2017/04/10 16:43:22
Moved to anonymous namespace
|
| + |
| } // namespace |
| // An animation observer to hide the view at the end of the animation. |
| @@ -190,6 +196,67 @@ AppListView::~AppListView() { |
| RemoveAllChildViews(true); |
| } |
| +void AppListView::InitializeWindow(gfx::NativeView parent, |
| + int initial_apps_page, |
| + const gfx::Point ¢er_of_display_window, |
| + const gfx::Rect display_work_area_bounds) { |
| + base::Time start_time = base::Time::Now(); |
| + |
| + InitContents(parent, initial_apps_page); |
| + AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); |
| + |
| + if (IsFullscreenAppListEnabled()) { |
| + set_color(kContentsBackgroundColor); |
| + views::Widget *widget = new views::Widget; |
| + views::Widget::InitParams app_list_overlay_view_params( |
| + views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| + |
| + app_list_overlay_view_params.parent = parent; |
| + app_list_overlay_view_params.delegate = this; |
| + |
| + widget->Init(app_list_overlay_view_params); |
| + widget->SetBounds(display_work_area_bounds); |
| + widget->GetLayer()->SetFillsBoundsOpaquely(false); |
| + widget->GetLayer()->SetBackgroundBlur(20); |
|
vadimt
2017/04/10 19:40:10
Please check this value with UX.
newcomer
2017/04/13 21:13:59
Waiting on our ux people for this.
|
| + |
| + InitChildWidgets(); |
| + overlay_view_ = new AppListOverlayView(0 /* no corners */); |
| + AddChildView(overlay_view_); |
| + |
| + } else { |
| + set_margins(gfx::Insets()); |
| + set_parent_window(parent); |
| + set_close_on_deactivate(false); |
| + set_shadow(views::BubbleBorder::NO_ASSETS); |
| + set_color(kContentsBackgroundColor); |
| + |
| + // This creates the app list widget. (Before this, child widgets cannot be |
| + // created.) |
| + views::BubbleDialogDelegateView::CreateBubble(this); |
| + |
| + SetBubbleArrow(views::BubbleBorder::FLOAT); |
| + // We can now create the internal widgets. |
| + |
| + InitChildWidgets(); |
| + aura::Window *window = GetWidget()->GetNativeWindow(); |
| + window->SetEventTargeter( |
| + base::MakeUnique<views::BubbleWindowTargeter>(this)); |
| + |
| + const int kOverlayCornerRadius = |
| + GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(); |
| + overlay_view_ = new AppListOverlayView(kOverlayCornerRadius); |
| + overlay_view_->SetBoundsRect(GetContentsBounds()); |
| + AddChildView(overlay_view_); |
| + SetAnchorPoint(center_of_display_window); |
| + } |
| + |
| + if (delegate_) |
| + delegate_->ViewInitialized(); |
| + |
| + UMA_HISTOGRAM_TIMES("Apps.AppListCreationTime", |
| + base::Time::Now() - start_time); |
| +} |
| + |
| void AppListView::InitAsBubble(gfx::NativeView parent, int initial_apps_page) { |
| base::Time start_time = base::Time::Now(); |
| @@ -304,6 +371,10 @@ void AppListView::OnPaint(gfx::Canvas* canvas) { |
| } |
| } |
| +const char* AppListView::GetClassName() const { |
| + return "AppListView"; |
| +} |
| + |
| bool AppListView::ShouldHandleSystemCommands() const { |
| return true; |
| } |
| @@ -343,7 +414,6 @@ void AppListView::InitContents(gfx::NativeView parent, int initial_apps_page) { |
| app_list_main_view_->SetPaintToLayer(); |
| app_list_main_view_->layer()->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_); |