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

Side by Side 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: Fix gesture recognizer tests 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 unified diff | Download patch
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 #include <memory> 8 #include <memory>
9 9
10 #include "ash/ash_constants.h" 10 #include "ash/ash_constants.h"
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 snap_back_from_rip_off_view_ = nullptr; 1866 snap_back_from_rip_off_view_ = nullptr;
1867 } 1867 }
1868 } 1868 }
1869 } 1869 }
1870 1870
1871 bool ShelfView::IsRepostEvent(const ui::Event& event) { 1871 bool ShelfView::IsRepostEvent(const ui::Event& event) {
1872 if (closing_event_time_.is_zero()) 1872 if (closing_event_time_.is_zero())
1873 return false; 1873 return false;
1874 1874
1875 base::TimeDelta delta = 1875 base::TimeDelta delta =
1876 base::TimeDelta(event.time_stamp() - closing_event_time_); 1876 (event.time_stamp() - closing_event_time_) - base::TimeTicks();
1877 closing_event_time_ = base::TimeDelta(); 1877 closing_event_time_ = base::TimeDelta();
miu 2016/05/16 20:05:35 IIUC, closing_event_time_ needs to be changed to b
majidvp 2016/05/21 01:38:00 It should be eventually but I prefer to make that
1878 // If the current (press down) event is a repost event, the time stamp of 1878 // If the current (press down) event is a repost event, the time stamp of
1879 // these two events should be the same. 1879 // these two events should be the same.
1880 return (delta.InMilliseconds() == 0); 1880 return (delta.InMilliseconds() == 0);
miu 2016/05/16 20:05:35 The comment suggests this is a bug. Shouldn't this
majidvp 2016/05/21 01:38:00 I don't see how this logic is different from the e
miu 2016/05/25 01:42:31 What if |delta| is 999 usec? Then |delta.InMillise
majidvp 2016/05/27 14:34:15 Doh! I totally missed the milliseconds conversion.
1881 } 1881 }
1882 1882
1883 const ShelfItem* ShelfView::ShelfItemForView(const views::View* view) const { 1883 const ShelfItem* ShelfView::ShelfItemForView(const views::View* view) const {
1884 const int view_index = view_model_->GetIndexOfView(view); 1884 const int view_index = view_model_->GetIndexOfView(view);
1885 return (view_index < 0) ? nullptr : &(model_->items()[view_index]); 1885 return (view_index < 0) ? nullptr : &(model_->items()[view_index]);
1886 } 1886 }
1887 1887
1888 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1888 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1889 const gfx::Rect bounds = GetBoundsInScreen(); 1889 const gfx::Rect bounds = GetBoundsInScreen();
1890 int distance = shelf_->SelectValueForShelfAlignment( 1890 int distance = shelf_->SelectValueForShelfAlignment(
1891 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1891 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1892 bounds.x() - coordinate.x()); 1892 bounds.x() - coordinate.x());
1893 return distance > 0 ? distance : 0; 1893 return distance > 0 ? distance : 0;
1894 } 1894 }
1895 1895
1896 } // namespace ash 1896 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698