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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java

Issue 1493403002: Make pull to refresh not perform regular reload (with cache revalidation) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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
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 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.view.ViewGroup.LayoutParams; 8 import android.view.ViewGroup.LayoutParams;
9 9
10 import org.chromium.base.TraceEvent; 10 import org.chromium.base.TraceEvent;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 public void onRefresh() { 85 public void onRefresh() {
86 cancelStopRefreshingRunnable(); 86 cancelStopRefreshingRunnable();
87 mSwipeRefreshLayout.postDelayed( 87 mSwipeRefreshLayout.postDelayed(
88 getStopRefreshingRunnable(), MAX_REFRESH_ANIMATION_DURAT ION_MS); 88 getStopRefreshingRunnable(), MAX_REFRESH_ANIMATION_DURAT ION_MS);
89 if (mAccessibilityRefreshString == null) { 89 if (mAccessibilityRefreshString == null) {
90 int resId = R.string.accessibility_swipe_refresh; 90 int resId = R.string.accessibility_swipe_refresh;
91 mAccessibilityRefreshString = 91 mAccessibilityRefreshString =
92 contentViewCore.getContext().getResources().getStrin g(resId); 92 contentViewCore.getContext().getResources().getStrin g(resId);
93 } 93 }
94 mSwipeRefreshLayout.announceForAccessibility(mAccessibilityRefre shString); 94 mSwipeRefreshLayout.announceForAccessibility(mAccessibilityRefre shString);
95 contentViewCore.getWebContents().getNavigationController().reloa d(true); 95 contentViewCore.getWebContents().getNavigationController().reloa dToRefreshContent(
newt (away) 2015/12/15 22:40:21 Instead of a reload, could we simply load the curr
kinuko 2015/12/15 22:54:38 That'd probably work, but I thought we might still
96 true);
96 RecordUserAction.record("MobilePullGestureReload"); 97 RecordUserAction.record("MobilePullGestureReload");
97 } 98 }
98 }); 99 });
99 contentViewCore.setOverscrollRefreshHandler(this); 100 contentViewCore.setOverscrollRefreshHandler(this);
100 } 101 }
101 102
102 /** 103 /**
103 * Notify the SwipeRefreshLayout that a refresh action has completed. 104 * Notify the SwipeRefreshLayout that a refresh action has completed.
104 * Defer the notification by a reasonable minimum to ensure sufficient 105 * Defer the notification by a reasonable minimum to ensure sufficient
105 * visiblity of the animation. 106 * visiblity of the animation.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 173 }
173 174
174 private void detachSwipeRefreshLayoutIfNecessary() { 175 private void detachSwipeRefreshLayoutIfNecessary() {
175 // TODO(jdduke): Also detach the effect when its animation ends. 176 // TODO(jdduke): Also detach the effect when its animation ends.
176 if (mContentViewCore == null) return; 177 if (mContentViewCore == null) return;
177 if (mSwipeRefreshLayout.getParent() != null) { 178 if (mSwipeRefreshLayout.getParent() != null) {
178 mContentViewCore.getContainerView().removeView(mSwipeRefreshLayout); 179 mContentViewCore.getContainerView().removeView(mSwipeRefreshLayout);
179 } 180 }
180 } 181 }
181 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698