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

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: periods Created 3 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 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; 9 import org.chromium.base.VisibleForTesting;
10 import org.chromium.base.annotations.CalledByNative; 10 import org.chromium.base.annotations.CalledByNative;
(...skipping 25 matching lines...) Expand all
36 private final String mUnfilteredLinkUrl; 36 private final String mUnfilteredLinkUrl;
37 private final String mSrcUrl; 37 private final String mSrcUrl;
38 private final boolean mImageWasFetchedLoFi; 38 private final boolean mImageWasFetchedLoFi;
39 private final Referrer mReferrer; 39 private final Referrer mReferrer;
40 40
41 private final boolean mIsAnchor; 41 private final boolean mIsAnchor;
42 private final boolean mIsImage; 42 private final boolean mIsImage;
43 private final boolean mIsVideo; 43 private final boolean mIsVideo;
44 private final boolean mCanSavemedia; 44 private final boolean mCanSavemedia;
45 45
46 private final int mX;
47 private final int mY;
48
46 /** 49 /**
47 * @return The URL associated with the main frame of the page that triggered the context menu. 50 * @return The URL associated with the main frame of the page that triggered the context menu.
48 */ 51 */
49 public String getPageUrl() { 52 public String getPageUrl() {
50 return mPageUrl; 53 return mPageUrl;
51 } 54 }
52 55
53 /** 56 /**
54 * @return The link URL, if any. 57 * @return The link URL, if any.
55 */ 58 */
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 /** 130 /**
128 * @return Whether or not the context menu is been shown for a download item . 131 * @return Whether or not the context menu is been shown for a download item .
129 */ 132 */
130 public boolean isFile() { 133 public boolean isFile() {
131 if (!TextUtils.isEmpty(mSrcUrl) && mSrcUrl.startsWith(UrlConstants.FILE_ URL_PREFIX)) { 134 if (!TextUtils.isEmpty(mSrcUrl) && mSrcUrl.startsWith(UrlConstants.FILE_ URL_PREFIX)) {
132 return true; 135 return true;
133 } 136 }
134 return false; 137 return false;
135 } 138 }
136 139
140 /**
141 * @return The x-coordinate of the touch in dp relative to the content windo w;
Theresa 2017/05/23 01:58:07 nit: of the touch that triggered the context menu.
Daniel Park 2017/05/24 16:44:31 Done.
142 * 0 corresponds to the left edge.
143 */
144 public int getX() {
145 return mX;
146 }
147
148 /**
149 * @return The y-coordinate of the touch in dp relative to the content windo w;
150 * 0 corresponds to the top edge.
151 */
152 public int getY() {
153 return mY;
154 }
155
137 @VisibleForTesting 156 @VisibleForTesting
138 ContextMenuParams(int mediaType, String pageUrl, String linkUrl, String link Text, 157 ContextMenuParams(int mediaType, String pageUrl, String linkUrl, String link Text,
139 String unfilteredLinkUrl, String srcUrl, String titleText, boolean i mageWasFetchedLoFi, 158 String unfilteredLinkUrl, String srcUrl, String titleText, boolean i mageWasFetchedLoFi,
140 Referrer referrer, boolean canSavemedia) { 159 Referrer referrer, boolean canSavemedia, int x, int y) {
141 mPageUrl = pageUrl; 160 mPageUrl = pageUrl;
142 mLinkUrl = linkUrl; 161 mLinkUrl = linkUrl;
143 mLinkText = linkText; 162 mLinkText = linkText;
144 mTitleText = titleText; 163 mTitleText = titleText;
145 mUnfilteredLinkUrl = unfilteredLinkUrl; 164 mUnfilteredLinkUrl = unfilteredLinkUrl;
146 mSrcUrl = srcUrl; 165 mSrcUrl = srcUrl;
147 mImageWasFetchedLoFi = imageWasFetchedLoFi; 166 mImageWasFetchedLoFi = imageWasFetchedLoFi;
148 mReferrer = referrer; 167 mReferrer = referrer;
149 168
150 mIsAnchor = !TextUtils.isEmpty(linkUrl); 169 mIsAnchor = !TextUtils.isEmpty(linkUrl);
151 mIsImage = mediaType == MediaType.MEDIA_TYPE_IMAGE; 170 mIsImage = mediaType == MediaType.MEDIA_TYPE_IMAGE;
152 mIsVideo = mediaType == MediaType.MEDIA_TYPE_VIDEO; 171 mIsVideo = mediaType == MediaType.MEDIA_TYPE_VIDEO;
153 mCanSavemedia = canSavemedia; 172 mCanSavemedia = canSavemedia;
173 mX = x;
174 mY = y;
154 } 175 }
155 176
156 @CalledByNative 177 @CalledByNative
157 private static ContextMenuParams create(int mediaType, String pageUrl, Strin g linkUrl, 178 private static ContextMenuParams create(int mediaType, String pageUrl, Strin g linkUrl,
158 String linkText, String unfilteredLinkUrl, String srcUrl, String tit leText, 179 String linkText, String unfilteredLinkUrl, String srcUrl, String tit leText,
159 boolean imageWasFetchedLoFi, String sanitizedReferrer, int referrerP olicy, 180 boolean imageWasFetchedLoFi, String sanitizedReferrer, int referrerP olicy,
160 boolean canSavemedia) { 181 boolean canSavemedia, int x, int y) {
161 Referrer referrer = TextUtils.isEmpty(sanitizedReferrer) 182 Referrer referrer = TextUtils.isEmpty(sanitizedReferrer)
162 ? null : new Referrer(sanitizedReferrer, referrerPolicy); 183 ? null : new Referrer(sanitizedReferrer, referrerPolicy);
163 return new ContextMenuParams(mediaType, pageUrl, linkUrl, linkText, unfi lteredLinkUrl, 184 return new ContextMenuParams(mediaType, pageUrl, linkUrl, linkText, unfi lteredLinkUrl,
164 srcUrl, titleText, imageWasFetchedLoFi, referrer, canSavemedia); 185 srcUrl, titleText, imageWasFetchedLoFi, referrer, canSavemedia, x, y);
165 } 186 }
166 } 187 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698