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

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

Issue 1126203011: Start displaying title text for HTML elements without links. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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.CalledByNative; 9 import org.chromium.base.CalledByNative;
10 import org.chromium.base.JNINamespace; 10 import org.chromium.base.JNINamespace;
(...skipping 24 matching lines...) Expand all
35 35
36 public CustomMenuItem(String label, int action) { 36 public CustomMenuItem(String label, int action) {
37 this.label = label; 37 this.label = label;
38 this.action = action; 38 this.action = action;
39 } 39 }
40 } 40 }
41 41
42 private final String mPageUrl; 42 private final String mPageUrl;
43 private final String mLinkUrl; 43 private final String mLinkUrl;
44 private final String mLinkText; 44 private final String mLinkText;
45 private final String mTitleText;
45 private final String mUnfilteredLinkUrl; 46 private final String mUnfilteredLinkUrl;
46 private final String mSrcUrl; 47 private final String mSrcUrl;
47 private final boolean mIsEditable; 48 private final boolean mIsEditable;
48 private final Referrer mReferrer; 49 private final Referrer mReferrer;
49 50
50 private final boolean mIsAnchor; 51 private final boolean mIsAnchor;
51 private final boolean mIsSelectedText; 52 private final boolean mIsSelectedText;
52 private final boolean mIsImage; 53 private final boolean mIsImage;
53 private final boolean mIsVideo; 54 private final boolean mIsVideo;
54 55
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 104 }
104 105
105 /** 106 /**
106 * @return The link text, if any. 107 * @return The link text, if any.
107 */ 108 */
108 public String getLinkText() { 109 public String getLinkText() {
109 return mLinkText; 110 return mLinkText;
110 } 111 }
111 112
112 /** 113 /**
114 * @return The title or alt atribute (if title is not available).
Ted C 2015/05/15 23:24:55 two ts in attribute
aurimas (slooooooooow) 2015/05/15 23:34:11 Done
115 */
116 public String getTitleText() {
117 return mTitleText;
118 }
119
120 /**
113 * @return The unfiltered link URL, if any. 121 * @return The unfiltered link URL, if any.
114 */ 122 */
115 public String getUnfilteredLinkUrl() { 123 public String getUnfilteredLinkUrl() {
116 return mUnfilteredLinkUrl; 124 return mUnfilteredLinkUrl;
117 } 125 }
118 126
119 /** 127 /**
120 * @return The source URL. 128 * @return The source URL.
121 */ 129 */
122 public String getSrcUrl() { 130 public String getSrcUrl() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 167 }
160 168
161 /** 169 /**
162 * @return Whether or not the context menu is being shown for a video. 170 * @return Whether or not the context menu is being shown for a video.
163 */ 171 */
164 public boolean isVideo() { 172 public boolean isVideo() {
165 return mIsVideo; 173 return mIsVideo;
166 } 174 }
167 175
168 private ContextMenuParams(int mediaType, String pageUrl, String linkUrl, Str ing linkText, 176 private ContextMenuParams(int mediaType, String pageUrl, String linkUrl, Str ing linkText,
169 String unfilteredLinkUrl, String srcUrl, String selectionText, boole an isEditable, 177 String unfilteredLinkUrl, String srcUrl, String selectionText, Strin g titleText,
170 Referrer referrer) { 178 boolean isEditable, Referrer referrer) {
171 mPageUrl = pageUrl; 179 mPageUrl = pageUrl;
172 mLinkUrl = linkUrl; 180 mLinkUrl = linkUrl;
173 mLinkText = linkText; 181 mLinkText = linkText;
182 mTitleText = titleText;
174 mUnfilteredLinkUrl = unfilteredLinkUrl; 183 mUnfilteredLinkUrl = unfilteredLinkUrl;
175 mSrcUrl = srcUrl; 184 mSrcUrl = srcUrl;
176 mIsEditable = isEditable; 185 mIsEditable = isEditable;
177 mReferrer = referrer; 186 mReferrer = referrer;
178 187
179 mIsAnchor = !TextUtils.isEmpty(linkUrl); 188 mIsAnchor = !TextUtils.isEmpty(linkUrl);
180 mIsSelectedText = !TextUtils.isEmpty(selectionText); 189 mIsSelectedText = !TextUtils.isEmpty(selectionText);
181 mIsImage = mediaType == MediaType.MEDIA_TYPE_IMAGE; 190 mIsImage = mediaType == MediaType.MEDIA_TYPE_IMAGE;
182 mIsVideo = mediaType == MediaType.MEDIA_TYPE_VIDEO; 191 mIsVideo = mediaType == MediaType.MEDIA_TYPE_VIDEO;
183 } 192 }
184 193
185 @CalledByNative 194 @CalledByNative
186 private static ContextMenuParams create(int mediaType, String pageUrl, Strin g linkUrl, 195 private static ContextMenuParams create(int mediaType, String pageUrl, Strin g linkUrl,
187 String linkText, String unfilteredLinkUrl, String srcUrl, String sel ectionText, 196 String linkText, String unfilteredLinkUrl, String srcUrl, String sel ectionText,
188 boolean isEditable, String sanitizedReferrer, int referrerPolicy) { 197 String titleText, boolean isEditable, String sanitizedReferrer, int referrerPolicy) {
189 Referrer referrer = TextUtils.isEmpty(sanitizedReferrer) 198 Referrer referrer = TextUtils.isEmpty(sanitizedReferrer)
190 ? null : new Referrer(sanitizedReferrer, referrerPolicy); 199 ? null : new Referrer(sanitizedReferrer, referrerPolicy);
191 return new ContextMenuParams(mediaType, pageUrl, linkUrl, linkText, unfi lteredLinkUrl, 200 return new ContextMenuParams(mediaType, pageUrl, linkUrl, linkText, unfi lteredLinkUrl,
192 srcUrl, selectionText, isEditable, referrer); 201 srcUrl, selectionText, titleText, isEditable, referrer);
193 } 202 }
194 203
195 @CalledByNative 204 @CalledByNative
196 private void addCustomItem(String label, int action) { 205 private void addCustomItem(String label, int action) {
197 mCustomMenuItems.add(new CustomMenuItem(label, action)); 206 mCustomMenuItems.add(new CustomMenuItem(label, action));
198 } 207 }
199 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698