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

Side by Side Diff: ash/shelf/shelf_view.cc

Issue 772963002: Make the second click on the app shelf icon close the window-list bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/shelf/shelf_view.h" 5 #include "ash/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 closing_event_time_(base::TimeDelta()), 382 closing_event_time_(base::TimeDelta()),
383 got_deleted_(NULL), 383 got_deleted_(NULL),
384 drag_and_drop_item_pinned_(false), 384 drag_and_drop_item_pinned_(false),
385 drag_and_drop_shelf_id_(0), 385 drag_and_drop_shelf_id_(0),
386 dragged_off_shelf_(false), 386 dragged_off_shelf_(false),
387 snap_back_from_rip_off_view_(NULL), 387 snap_back_from_rip_off_view_(NULL),
388 item_manager_(Shell::GetInstance()->shelf_item_delegate_manager()), 388 item_manager_(Shell::GetInstance()->shelf_item_delegate_manager()),
389 layout_manager_(manager), 389 layout_manager_(manager),
390 overflow_mode_(false), 390 overflow_mode_(false),
391 main_shelf_(NULL), 391 main_shelf_(NULL),
392 dragged_off_from_overflow_to_shelf_(false) { 392 dragged_off_from_overflow_to_shelf_(false),
393 pressed_on_same_position_(false) {
393 DCHECK(model_); 394 DCHECK(model_);
394 bounds_animator_.reset(new views::BoundsAnimator(this)); 395 bounds_animator_.reset(new views::BoundsAnimator(this));
395 bounds_animator_->AddObserver(this); 396 bounds_animator_->AddObserver(this);
396 set_context_menu_controller(this); 397 set_context_menu_controller(this);
397 focus_search_.reset(new ShelfFocusSearch(view_model_.get())); 398 focus_search_.reset(new ShelfFocusSearch(view_model_.get()));
398 tooltip_.reset(new ShelfTooltipManager(manager, this)); 399 tooltip_.reset(new ShelfTooltipManager(manager, this));
399 } 400 }
400 401
401 ShelfView::~ShelfView() { 402 ShelfView::~ShelfView() {
402 bounds_animator_->RemoveObserver(this); 403 bounds_animator_->RemoveObserver(this);
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 AnimateToIdealBounds(); 1553 AnimateToIdealBounds();
1553 } 1554 }
1554 1555
1555 void ShelfView::ShelfStatusChanged() { 1556 void ShelfView::ShelfStatusChanged() {
1556 // Nothing to do here. 1557 // Nothing to do here.
1557 } 1558 }
1558 1559
1559 void ShelfView::PointerPressedOnButton(views::View* view, 1560 void ShelfView::PointerPressedOnButton(views::View* view,
1560 Pointer pointer, 1561 Pointer pointer,
1561 const ui::LocatedEvent& event) { 1562 const ui::LocatedEvent& event) {
1563 // Compare the current position with the previous one.
1564 // If |pressed_on_same_position_| equals true, which means the previous
1565 // pointer press was ignored, reset it to false to make sure the current
1566 // press event won't be ignored in ShelfView::ButtonPressed(...). Otherwise
1567 // if the current press position is the same with the previous one, ignore
1568 // the current press event.
Mr4D (OOO till 08-26) 2014/12/02 21:40:12 You do not want to do this because of various reas
1569 gfx::Point current_position = gfx::Point(event.x(), event.y());
1570 if (pressed_on_same_position_)
1571 pressed_on_same_position_ = false;
1572 else if (pointer_pressed_position_ == current_position)
1573 pressed_on_same_position_ = true;
1574 pointer_pressed_position_ = current_position;
1575
1562 if (drag_view_) 1576 if (drag_view_)
1563 return; 1577 return;
1564 1578
1565 int index = view_model_->GetIndexOfView(view); 1579 int index = view_model_->GetIndexOfView(view);
1566 if (index == -1) 1580 if (index == -1)
1567 return; 1581 return;
1568 1582
1569 ShelfItemDelegate* item_delegate = item_manager_->GetShelfItemDelegate( 1583 ShelfItemDelegate* item_delegate = item_manager_->GetShelfItemDelegate(
1570 model_->items()[index].id); 1584 model_->items()[index].id);
1571 if (view_model_->view_size() <= 1 || !item_delegate->IsDraggable()) 1585 if (view_model_->view_size() <= 1 || !item_delegate->IsDraggable())
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 int view_index = view_model_->GetIndexOfView(sender); 1675 int view_index = view_model_->GetIndexOfView(sender);
1662 // May be -1 while in the process of animating closed. 1676 // May be -1 while in the process of animating closed.
1663 if (view_index == -1) 1677 if (view_index == -1)
1664 return; 1678 return;
1665 1679
1666 // If the previous menu was closed by the same event as this one, we ignore 1680 // If the previous menu was closed by the same event as this one, we ignore
1667 // the call. 1681 // the call.
1668 if (!IsUsableEvent(event)) 1682 if (!IsUsableEvent(event))
1669 return; 1683 return;
1670 1684
1685 // If the current press position is the same with the previous one, we ignore
1686 // this one.
1687 if (pressed_on_same_position_)
1688 return;
1689
1671 // Don't activate the item twice on double-click. Otherwise the window starts 1690 // Don't activate the item twice on double-click. Otherwise the window starts
1672 // animating open due to the first click, then immediately minimizes due to 1691 // animating open due to the first click, then immediately minimizes due to
1673 // the second click. The user most likely intended to open or minimize the 1692 // the second click. The user most likely intended to open or minimize the
1674 // item once, not do both. 1693 // item once, not do both.
1675 if (event.flags() & ui::EF_IS_DOUBLE_CLICK) 1694 if (event.flags() & ui::EF_IS_DOUBLE_CLICK)
1676 return; 1695 return;
1677 1696
1678 { 1697 {
1679 ScopedTargetRootWindow scoped_target( 1698 ScopedTargetRootWindow scoped_target(
1680 sender->GetWidget()->GetNativeView()->GetRootWindow()); 1699 sender->GetWidget()->GetNativeView()->GetRootWindow());
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 distance = bounds.x() - coordinate.x(); 1944 distance = bounds.x() - coordinate.x();
1926 break; 1945 break;
1927 case SHELF_ALIGNMENT_TOP: 1946 case SHELF_ALIGNMENT_TOP:
1928 distance = coordinate.y() - bounds.bottom(); 1947 distance = coordinate.y() - bounds.bottom();
1929 break; 1948 break;
1930 } 1949 }
1931 return distance > 0 ? distance : 0; 1950 return distance > 0 ? distance : 0;
1932 } 1951 }
1933 1952
1934 } // namespace ash 1953 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698