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

Unified Diff: ui/app_list/views/app_list_main_view.cc

Issue 913133007: Allow scroll events to open custom launcher pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add tap Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ui/app_list/views/app_list_main_view.cc
diff --git a/ui/app_list/views/app_list_main_view.cc b/ui/app_list/views/app_list_main_view.cc
index 312eacca3cf62eb39fdb3678708814e7b96dcf9e..436641c7c2550e46c81869dff42d3e6d3f1c743b 100644
--- a/ui/app_list/views/app_list_main_view.cc
+++ b/ui/app_list/views/app_list_main_view.cc
@@ -42,35 +42,6 @@ namespace {
// The maximum allowed time to wait for icon loading in milliseconds.
const int kMaxIconLoadingWaitTimeInMs = 50;
-// Button for the custom page click zone. Receives click events when the user
-// clicks on the custom page, and in response, switches to the custom page.
-class CustomPageButton : public views::CustomButton,
- public views::ButtonListener {
- public:
- explicit CustomPageButton(AppListMainView* app_list_main_view);
-
- // ButtonListener overrides:
- void ButtonPressed(views::Button* sender, const ui::Event& event) override;
-
- private:
- AppListMainView* app_list_main_view_;
-
- DISALLOW_COPY_AND_ASSIGN(CustomPageButton);
-};
-
-CustomPageButton::CustomPageButton(AppListMainView* app_list_main_view)
- : views::CustomButton(this), app_list_main_view_(app_list_main_view) {
-}
-
-void CustomPageButton::ButtonPressed(views::Button* sender,
- const ui::Event& event) {
- // Switch to the custom page.
- ContentsView* contents_view = app_list_main_view_->contents_view();
- int custom_page_index = contents_view->GetPageIndexForState(
- AppListModel::STATE_CUSTOM_LAUNCHER_PAGE);
- contents_view->SetActivePage(custom_page_index);
-}
-
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -112,7 +83,6 @@ AppListMainView::AppListMainView(AppListViewDelegate* delegate)
model_(delegate->GetModel()),
search_box_view_(nullptr),
contents_view_(nullptr),
- custom_page_clickzone_(nullptr),
weak_ptr_factory_(this) {
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
model_->AddObserver(this);
@@ -202,17 +172,6 @@ void AppListMainView::ModelChanged() {
Layout();
}
-views::Widget* AppListMainView::GetCustomPageClickzone() const {
- // During shutdown, the widgets may be deleted, which means
- // |custom_page_clickzone_| will be a dangling pointer. Therefore, always
- // check that the main app list widget (its parent) is still alive before
- // returning the pointer.
- if (!GetWidget())
- return nullptr;
-
- return custom_page_clickzone_;
-}
-
void AppListMainView::SetDragAndDropHostOfCurrentAppList(
ApplicationDragAndDropHost* drag_and_drop_host) {
contents_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host);
@@ -282,36 +241,6 @@ void AppListMainView::NotifySearchBoxVisibilityChanged() {
parent()->SchedulePaint();
}
-void AppListMainView::InitWidgets() {
- // TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed.
- tracked_objects::ScopedTracker tracking_profile(
- FROM_HERE_WITH_EXPLICIT_FUNCTION("431326 AppListMainView::InitWidgets"));
-
- // The widget that receives click events to transition to the custom page.
- views::Widget::InitParams custom_page_clickzone_params(
- views::Widget::InitParams::TYPE_CONTROL);
-
- custom_page_clickzone_params.parent = GetWidget()->GetNativeView();
- custom_page_clickzone_params.layer_type = aura::WINDOW_LAYER_NOT_DRAWN;
-
- gfx::Rect custom_page_bounds = contents_view_->GetCustomPageCollapsedBounds();
- custom_page_bounds.Intersect(contents_view_->bounds());
- custom_page_bounds = contents_view_->ConvertRectToWidget(custom_page_bounds);
- custom_page_clickzone_params.bounds = custom_page_bounds;
-
- // Create a widget for the custom page click zone. This widget masks click
- // events from the WebContents that rests underneath it. (It has to be a
- // widget, not an ordinary view, so that it can be placed in front of the
- // WebContents.)
- custom_page_clickzone_ = new views::Widget;
- custom_page_clickzone_->Init(custom_page_clickzone_params);
- custom_page_clickzone_->SetContentsView(new CustomPageButton(this));
- // The widget is shown by default. If the ContentsView determines that we do
- // not need a clickzone upon startup, hide it.
- if (!contents_view_->ShouldShowCustomPageClickzone())
- custom_page_clickzone_->Hide();
-}
-
void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) {
if (enabled) {
// Make the custom page view visible again.
@@ -326,8 +255,6 @@ void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) {
// Hide the view immediately otherwise.
contents_view_->custom_page_view()->SetVisible(false);
}
- // Allow the start page to update |custom_page_clickzone_|.
- contents_view_->start_page_view()->UpdateCustomPageClickzoneVisibility();
}
void AppListMainView::ActivateApp(AppListItem* item, int event_flags) {

Powered by Google App Engine
This is Rietveld 408576698