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

Side by Side Diff: android_webview/common/aw_hit_test_data.h

Issue 92903003: aw: Limit full url href hittest to only anchor type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix SRC_IMAGE_LINK_TYPE as well Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContents.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef ANDROID_WEBVIEW_COMMON_AW_HIT_TEST_DATA_H_ 5 #ifndef ANDROID_WEBVIEW_COMMON_AW_HIT_TEST_DATA_H_
6 #define ANDROID_WEBVIEW_COMMON_AW_HIT_TEST_DATA_H_ 6 #define ANDROID_WEBVIEW_COMMON_AW_HIT_TEST_DATA_H_
7 7
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
11 namespace android_webview { 11 namespace android_webview {
12 12
13 // Holdes all hit test data needed by public WebView APIs. 13 // Holdes all hit test data needed by public WebView APIs.
14 // The Java counter part to this is AwContents.HitTestData. 14 // The Java counter part to this is AwContents.HitTestData.
15 struct AwHitTestData { 15 struct AwHitTestData {
16 16
17 // Matches exactly with constants in WebView.HitTestResult, with deprecated 17 // Matches exactly with constants in WebView.HitTestResult, with deprecated
18 // values removed. 18 // values removed.
19 enum Type { 19 enum Type {
20 // Default type where nothing we are interested in is hit. 20 // Default type where nothing we are interested in is hit.
21 // |extra_data_for_type| will be empty. All other values should be emtpy 21 // |extra_data_for_type| will be empty. All other values should be emtpy
22 // except the special case described below. 22 // except the special case described below.
23 // For special case of invalid or javascript scheme url that would 23 // For special case of invalid or javascript scheme url that would
24 // otherwise be type an LINK type, |href|, |anchor_text|, |img_src| contain 24 // otherwise be type an LINK type, |href| will contain the javascript
25 // string in the href attribute, and |anchor_text|i and |img_src| contain
25 // their normal values for the respective type. 26 // their normal values for the respective type.
26 UNKNOWN_TYPE = 0, 27 UNKNOWN_TYPE = 0,
27 28
28 // Special case urls for SRC_LINK_TYPE below. Each type corresponds to a 29 // Special case urls for SRC_LINK_TYPE below. Each type corresponds to a
29 // different prefix in content url_constants. |extra_data_for_type| will 30 // different prefix in content url_constants. |extra_data_for_type| will
30 // contain the url but with the prefix removed. Other fields are the same 31 // contain the url but with the prefix removed. |href| will contain the
31 // as SRC_LINK_TYPE. 32 // exact href attribute string. Other fields are the same as SRC_LINK_TYPE.
32 PHONE_TYPE = 2, 33 PHONE_TYPE = 2,
33 GEO_TYPE = 3, 34 GEO_TYPE = 3,
34 EMAIL_TYPE = 4, 35 EMAIL_TYPE = 4,
35 36
36 // Hit on a pure image (without links). |extra_data_for_type|, |href|, 37 // Hit on a pure image (without links). |extra_data_for_type|, |href|,
37 // and |anchor_text| will be empty. |img_src| will contain the absolute 38 // and |anchor_text| will be empty. |img_src| will contain the absolute
38 // source url of the image. 39 // source url of the image.
39 IMAGE_TYPE = 5, 40 IMAGE_TYPE = 5,
40 41
41 // Hit on a link with valid and non-javascript url and without embedded 42 // Hit on a link with valid and non-javascript url and without embedded
42 // image. |extra_data_for_type| is the valid absolute url of the link. 43 // image. |extra_data_for_type| and |href| will be the valid absolute url
43 // |href| will contain the exact href attribute string. |anchor_text| will 44 // of the link. |anchor_text| will contain the anchor text if the link is
44 // contain the anchor text if the link is an anchor tag. |img_src| will be 45 // an anchor tag. |img_src| will be empty.
45 // empty.
46 // Note 1: If the link url is invalid or javascript scheme, then the type 46 // Note 1: If the link url is invalid or javascript scheme, then the type
47 // will be UNKNOWN_TYPE. 47 // will be UNKNOWN_TYPE.
48 // Note 2: Note that this matches SRC_ANCHOR_TYPE in the public WebView 48 // Note 2: Note that this matches SRC_ANCHOR_TYPE in the public WebView
49 // Java API, but the actual tag can be something other than <a>, such as 49 // Java API, but the actual tag can be something other than <a>, such as
50 // <link> or <area>. 50 // <link> or <area>.
51 // Note 3: |href| is not the raw attribute string, but the absolute link
52 // url.
51 SRC_LINK_TYPE = 7, 53 SRC_LINK_TYPE = 7,
52 54
53 // Same as SRC_LINK_TYPE except the link contains an image. |img_src| and 55 // Same as SRC_LINK_TYPE except the link contains an image. |img_src| and
54 // |extra_data_for_type| will contain the absolute valid url of the image 56 // |extra_data_for_type| will contain the absolute valid url of the image
55 // source. |href| will contain the (possibly invalid or javascript-scheme) 57 // source. |href| will be the valid absolute url of the link. |anchor_text|
56 // link href attribute. |anchor_text| will be empty. 58 // will be empty. All notes from SRC_LINK_TYPE apply.
57 // Both notes from SRC_LINK_TYPE apply.
58 SRC_IMAGE_LINK_TYPE = 8, 59 SRC_IMAGE_LINK_TYPE = 8,
59 60
60 // Hit on an editable text input element. All other values will be empty. 61 // Hit on an editable text input element. All other values will be empty.
61 EDIT_TEXT_TYPE = 9, 62 EDIT_TEXT_TYPE = 9,
62 }; 63 };
63 64
64 // For all strings/GURLs, empty/invalid will become null upon conversion to 65 // For all strings/GURLs, empty/invalid will become null upon conversion to
65 // Java. 66 // Java.
66 int type; // Only values from enum Type above. 67 int type; // Only values from enum Type above.
67 std::string extra_data_for_type; 68 std::string extra_data_for_type;
68 string16 href; 69 string16 href;
69 string16 anchor_text; 70 string16 anchor_text;
70 GURL img_src; 71 GURL img_src;
71 72
72 AwHitTestData(); 73 AwHitTestData();
73 ~AwHitTestData(); 74 ~AwHitTestData();
74 }; 75 };
75 76
76 } // namespace android_webview 77 } // namespace android_webview
77 78
78 #endif // ANDROID_WEBVIEW_COMMON_AW_HIT_TEST_DATA_H_ 79 #endif // ANDROID_WEBVIEW_COMMON_AW_HIT_TEST_DATA_H_
OLDNEW
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContents.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698