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

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

Issue 2868403003: added scale animation for context menu (Closed)
Patch Set: fixing broken tests Created 3 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.contextmenu; 5 package org.chromium.chrome.browser.contextmenu;
6 6
7 import android.text.TextUtils; 7 import android.text.TextUtils;
8 8
9 import org.chromium.base.VisibleForTesting;
10 import org.chromium.base.annotations.CalledByNative; 9 import org.chromium.base.annotations.CalledByNative;
11 import org.chromium.base.annotations.JNINamespace; 10 import org.chromium.base.annotations.JNINamespace;
12 import org.chromium.chrome.browser.UrlConstants; 11 import org.chromium.chrome.browser.UrlConstants;
13 import org.chromium.content_public.common.Referrer; 12 import org.chromium.content_public.common.Referrer;
14 13
15 /** 14 /**
16 * A list of parameters that explain what kind of context menu to show the user. This data is 15 * A list of parameters that explain what kind of context menu to show the user. This data is
17 * generated from content/public/common/context_menu_params.h. 16 * generated from content/public/common/context_menu_params.h.
18 */ 17 */
19 @JNINamespace("ContextMenuParamsAndroid") 18 @JNINamespace("ContextMenuParamsAndroid")
(...skipping 16 matching lines...) Expand all
36 private final String mUnfilteredLinkUrl; 35 private final String mUnfilteredLinkUrl;
37 private final String mSrcUrl; 36 private final String mSrcUrl;
38 private final boolean mImageWasFetchedLoFi; 37 private final boolean mImageWasFetchedLoFi;
39 private final Referrer mReferrer; 38 private final Referrer mReferrer;
40 39
41 private final boolean mIsAnchor; 40 private final boolean mIsAnchor;
42 private final boolean mIsImage; 41 private final boolean mIsImage;
43 private final boolean mIsVideo; 42 private final boolean mIsVideo;
44 private final boolean mCanSaveMedia; 43 private final boolean mCanSaveMedia;
45 44
45 private final int mTriggeringTouchXDp;
46 private final int mTriggeringTouchYDp;
47
46 /** 48 /**
47 * @return The URL associated with the main frame of the page that triggered the context menu. 49 * @return The URL associated with the main frame of the page that triggered the context menu.
48 */ 50 */
49 public String getPageUrl() { 51 public String getPageUrl() {
50 return mPageUrl; 52 return mPageUrl;
51 } 53 }
52 54
53 /** 55 /**
54 * @return The link URL, if any. 56 * @return The link URL, if any.
55 */ 57 */
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 /** 129 /**
128 * @return Whether or not the context menu is been shown for a download item . 130 * @return Whether or not the context menu is been shown for a download item .
129 */ 131 */
130 public boolean isFile() { 132 public boolean isFile() {
131 if (!TextUtils.isEmpty(mSrcUrl) && mSrcUrl.startsWith(UrlConstants.FILE_ URL_PREFIX)) { 133 if (!TextUtils.isEmpty(mSrcUrl) && mSrcUrl.startsWith(UrlConstants.FILE_ URL_PREFIX)) {
132 return true; 134 return true;
133 } 135 }
134 return false; 136 return false;
135 } 137 }
136 138
137 @VisibleForTesting 139 /**
140 * @return The x-coordinate of the touch that triggered the context menu in dp relative to the
141 * render view; 0 corresponds to the left edge.
142 */
143 public int getTriggeringTouchXDp() {
144 return mTriggeringTouchXDp;
145 }
146
147 /**
148 * @return The y-coordinate of the touch that triggered the context menu in dp relative to the
149 * render view; 0 corresponds to the left edge.
150 */
151 public int getTriggeringTouchYDp() {
152 return mTriggeringTouchYDp;
153 }
154
138 public ContextMenuParams(int mediaType, String pageUrl, String linkUrl, Stri ng linkText, 155 public ContextMenuParams(int mediaType, String pageUrl, String linkUrl, Stri ng linkText,
139 String unfilteredLinkUrl, String srcUrl, String titleText, boolean i mageWasFetchedLoFi, 156 String unfilteredLinkUrl, String srcUrl, String titleText, boolean i mageWasFetchedLoFi,
140 Referrer referrer, boolean canSaveMedia) { 157 Referrer referrer, boolean canSaveMedia, int triggeringTouchXDp,
158 int triggeringTouchYDp) {
141 mPageUrl = pageUrl; 159 mPageUrl = pageUrl;
142 mLinkUrl = linkUrl; 160 mLinkUrl = linkUrl;
143 mLinkText = linkText; 161 mLinkText = linkText;
144 mTitleText = titleText; 162 mTitleText = titleText;
145 mUnfilteredLinkUrl = unfilteredLinkUrl; 163 mUnfilteredLinkUrl = unfilteredLinkUrl;
146 mSrcUrl = srcUrl; 164 mSrcUrl = srcUrl;
147 mImageWasFetchedLoFi = imageWasFetchedLoFi; 165 mImageWasFetchedLoFi = imageWasFetchedLoFi;
148 mReferrer = referrer; 166 mReferrer = referrer;
149 167
150 mIsAnchor = !TextUtils.isEmpty(linkUrl); 168 mIsAnchor = !TextUtils.isEmpty(linkUrl);
151 mIsImage = mediaType == MediaType.MEDIA_TYPE_IMAGE; 169 mIsImage = mediaType == MediaType.MEDIA_TYPE_IMAGE;
152 mIsVideo = mediaType == MediaType.MEDIA_TYPE_VIDEO; 170 mIsVideo = mediaType == MediaType.MEDIA_TYPE_VIDEO;
153 mCanSaveMedia = canSaveMedia; 171 mCanSaveMedia = canSaveMedia;
172 mTriggeringTouchXDp = triggeringTouchXDp;
173 mTriggeringTouchYDp = triggeringTouchYDp;
154 } 174 }
155 175
156 @CalledByNative 176 @CalledByNative
157 private static ContextMenuParams create(int mediaType, String pageUrl, Strin g linkUrl, 177 private static ContextMenuParams create(int mediaType, String pageUrl, Strin g linkUrl,
158 String linkText, String unfilteredLinkUrl, String srcUrl, String tit leText, 178 String linkText, String unfilteredLinkUrl, String srcUrl, String tit leText,
159 boolean imageWasFetchedLoFi, String sanitizedReferrer, int referrerP olicy, 179 boolean imageWasFetchedLoFi, String sanitizedReferrer, int referrerP olicy,
160 boolean canSaveMedia) { 180 boolean canSaveMedia, int triggeringTouchXDp, int triggeringTouchYDp ) {
161 Referrer referrer = TextUtils.isEmpty(sanitizedReferrer) 181 Referrer referrer = TextUtils.isEmpty(sanitizedReferrer)
162 ? null : new Referrer(sanitizedReferrer, referrerPolicy); 182 ? null : new Referrer(sanitizedReferrer, referrerPolicy);
163 return new ContextMenuParams(mediaType, pageUrl, linkUrl, linkText, unfi lteredLinkUrl, 183 return new ContextMenuParams(mediaType, pageUrl, linkUrl, linkText, unfi lteredLinkUrl,
164 srcUrl, titleText, imageWasFetchedLoFi, referrer, canSaveMedia); 184 srcUrl, titleText, imageWasFetchedLoFi, referrer, canSaveMedia, triggeringTouchXDp,
185 triggeringTouchYDp);
165 } 186 }
166 } 187 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698