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

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: switching context menu tab bug fix 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 public int getX() {
Theresa 2017/05/19 17:19:30 Public methods need JavaDocs. It would be good to
Daniel Park 2017/05/22 18:12:55 Done.
141 return mX;
142 }
143
144 public int getY() {
145 return mY;
146 }
147
137 @VisibleForTesting 148 @VisibleForTesting
138 ContextMenuParams(int mediaType, String pageUrl, String linkUrl, String link Text, 149 ContextMenuParams(int mediaType, String pageUrl, String linkUrl, String link Text,
139 String unfilteredLinkUrl, String srcUrl, String titleText, boolean i mageWasFetchedLoFi, 150 String unfilteredLinkUrl, String srcUrl, String titleText, boolean i mageWasFetchedLoFi,
140 Referrer referrer, boolean canSavemedia) { 151 Referrer referrer, boolean canSavemedia, int x, int y) {
141 mPageUrl = pageUrl; 152 mPageUrl = pageUrl;
142 mLinkUrl = linkUrl; 153 mLinkUrl = linkUrl;
143 mLinkText = linkText; 154 mLinkText = linkText;
144 mTitleText = titleText; 155 mTitleText = titleText;
145 mUnfilteredLinkUrl = unfilteredLinkUrl; 156 mUnfilteredLinkUrl = unfilteredLinkUrl;
146 mSrcUrl = srcUrl; 157 mSrcUrl = srcUrl;
147 mImageWasFetchedLoFi = imageWasFetchedLoFi; 158 mImageWasFetchedLoFi = imageWasFetchedLoFi;
148 mReferrer = referrer; 159 mReferrer = referrer;
149 160
150 mIsAnchor = !TextUtils.isEmpty(linkUrl); 161 mIsAnchor = !TextUtils.isEmpty(linkUrl);
151 mIsImage = mediaType == MediaType.MEDIA_TYPE_IMAGE; 162 mIsImage = mediaType == MediaType.MEDIA_TYPE_IMAGE;
152 mIsVideo = mediaType == MediaType.MEDIA_TYPE_VIDEO; 163 mIsVideo = mediaType == MediaType.MEDIA_TYPE_VIDEO;
153 mCanSavemedia = canSavemedia; 164 mCanSavemedia = canSavemedia;
165 mX = x;
166 mY = y;
154 } 167 }
155 168
156 @CalledByNative 169 @CalledByNative
157 private static ContextMenuParams create(int mediaType, String pageUrl, Strin g linkUrl, 170 private static ContextMenuParams create(int mediaType, String pageUrl, Strin g linkUrl,
158 String linkText, String unfilteredLinkUrl, String srcUrl, String tit leText, 171 String linkText, String unfilteredLinkUrl, String srcUrl, String tit leText,
159 boolean imageWasFetchedLoFi, String sanitizedReferrer, int referrerP olicy, 172 boolean imageWasFetchedLoFi, String sanitizedReferrer, int referrerP olicy,
160 boolean canSavemedia) { 173 boolean canSavemedia, int x, int y) {
161 Referrer referrer = TextUtils.isEmpty(sanitizedReferrer) 174 Referrer referrer = TextUtils.isEmpty(sanitizedReferrer)
162 ? null : new Referrer(sanitizedReferrer, referrerPolicy); 175 ? null : new Referrer(sanitizedReferrer, referrerPolicy);
163 return new ContextMenuParams(mediaType, pageUrl, linkUrl, linkText, unfi lteredLinkUrl, 176 return new ContextMenuParams(mediaType, pageUrl, linkUrl, linkText, unfi lteredLinkUrl,
164 srcUrl, titleText, imageWasFetchedLoFi, referrer, canSavemedia); 177 srcUrl, titleText, imageWasFetchedLoFi, referrer, canSavemedia, x, y);
165 } 178 }
166 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698