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

Side by Side Diff: content/browser/web_contents/aura/overscroll_window_delegate.cc

Issue 2983883002: Reset overscroll state when OverscrollWindowDelegate is destroyed.
Patch Set: Created 3 years, 5 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
« no previous file with comments | « content/browser/web_contents/aura/overscroll_window_delegate.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/web_contents/aura/overscroll_window_delegate.h" 5 #include "content/browser/web_contents/aura/overscroll_window_delegate.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "content/browser/frame_host/navigation_controller_impl.h" 8 #include "content/browser/frame_host/navigation_controller_impl.h"
9 #include "content/browser/frame_host/navigation_entry_impl.h" 9 #include "content/browser/frame_host/navigation_entry_impl.h"
10 #include "content/browser/renderer_host/overscroll_controller_delegate.h" 10 #include "content/browser/renderer_host/overscroll_controller_delegate.h"
11 #include "content/public/browser/overscroll_configuration.h" 11 #include "content/public/browser/overscroll_configuration.h"
12 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
13 #include "ui/events/event.h" 13 #include "ui/events/event.h"
14 #include "ui/gfx/image/image_png_rep.h" 14 #include "ui/gfx/image/image_png_rep.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 OverscrollWindowDelegate::OverscrollWindowDelegate( 18 OverscrollWindowDelegate::OverscrollWindowDelegate(
19 OverscrollControllerDelegate* delegate, 19 OverscrollControllerDelegate* delegate,
20 const gfx::Image& image) 20 const gfx::Image& image)
21 : delegate_(delegate), 21 : delegate_(delegate),
22 overscroll_mode_(OVERSCROLL_NONE),
23 delta_x_(0.f),
24 complete_threshold_ratio_(content::GetOverscrollConfig( 22 complete_threshold_ratio_(content::GetOverscrollConfig(
25 content::OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE)), 23 content::OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE)),
26 start_threshold_touchscreen_(content::GetOverscrollConfig( 24 start_threshold_touchscreen_(content::GetOverscrollConfig(
27 content::OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHSCREEN)), 25 content::OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHSCREEN)),
28 start_threshold_touchpad_(content::GetOverscrollConfig( 26 start_threshold_touchpad_(content::GetOverscrollConfig(
29 content::OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHPAD)), 27 content::OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHPAD)) {
30 active_start_threshold_(0.f) {
31 SetImage(image); 28 SetImage(image);
32 } 29 }
33 30
34 OverscrollWindowDelegate::~OverscrollWindowDelegate() { 31 OverscrollWindowDelegate::~OverscrollWindowDelegate() {
32 ResetOverscroll();
35 } 33 }
36 34
37 void OverscrollWindowDelegate::StartOverscroll(OverscrollSource source) { 35 void OverscrollWindowDelegate::StartOverscroll(OverscrollSource source) {
38 OverscrollMode old_mode = overscroll_mode_; 36 OverscrollMode old_mode = overscroll_mode_;
39 if (delta_x_ > 0) 37 if (delta_x_ > 0)
40 overscroll_mode_ = OVERSCROLL_EAST; 38 overscroll_mode_ = OVERSCROLL_EAST;
41 else 39 else
42 overscroll_mode_ = OVERSCROLL_WEST; 40 overscroll_mode_ = OVERSCROLL_WEST;
43 overscroll_source_ = source; 41 overscroll_source_ = source;
44 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_, source); 42 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_, source);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ResetOverscroll(); 128 ResetOverscroll();
131 break; 129 break;
132 130
133 default: 131 default:
134 break; 132 break;
135 } 133 }
136 event->SetHandled(); 134 event->SetHandled();
137 } 135 }
138 136
139 } // namespace content 137 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/aura/overscroll_window_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698