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

Unified Diff: ash/shelf/shelf_view.cc

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge master Created 4 years, 7 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: ash/shelf/shelf_view.cc
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index 31df20b585bec3e61e865336b40324e66cdcbfa9..71a3ff6656c511513e8381bd4f01b250dde88ecd 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -379,7 +379,7 @@ ShelfView::ShelfView(ShelfModel* model, ShelfDelegate* delegate, Shelf* shelf)
leading_inset_(kDefaultLeadingInset),
cancelling_drag_model_changed_(false),
last_hidden_index_(0),
- closing_event_time_(base::TimeDelta()),
+ closing_event_time_(base::TimeTicks()),
got_deleted_(nullptr),
drag_and_drop_item_pinned_(false),
drag_and_drop_shelf_id_(0),
@@ -1788,7 +1788,7 @@ void ShelfView::ShowMenu(ui::MenuModel* menu_model,
const gfx::Point& click_point,
bool context_menu,
ui::MenuSourceType source_type) {
- closing_event_time_ = base::TimeDelta();
+ closing_event_time_ = base::TimeTicks();
launcher_menu_runner_.reset(new views::MenuRunner(
menu_model, context_menu ? views::MenuRunner::CONTEXT_MENU : 0));
@@ -1841,7 +1841,8 @@ void ShelfView::ShowMenu(ui::MenuModel* menu_model,
// Unpinning an item will reset |launcher_menu_runner_| before coming here.
if (launcher_menu_runner_)
- closing_event_time_ = launcher_menu_runner_->closing_event_time();
+ closing_event_time_ =
+ base::TimeTicks() + launcher_menu_runner_->closing_event_time();
Shell::GetInstance()->UpdateShelfVisibility();
}
@@ -1873,15 +1874,14 @@ void ShelfView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) {
}
bool ShelfView::IsRepostEvent(const ui::Event& event) {
- if (closing_event_time_.is_zero())
+ if (closing_event_time_.is_null())
return false;
- base::TimeDelta delta =
- base::TimeDelta(event.time_stamp() - closing_event_time_);
- closing_event_time_ = base::TimeDelta();
+ base::TimeTicks last_closing_event_time = closing_event_time_;
+ closing_event_time_ = base::TimeTicks();
// If the current (press down) event is a repost event, the time stamp of
// these two events should be the same.
- return (delta.InMilliseconds() == 0);
+ return last_closing_event_time == event.time_stamp();
}
const ShelfItem* ShelfView::ShelfItemForView(const views::View* view) const {

Powered by Google App Engine
This is Rietveld 408576698