Commit 2c1be31a authored by Carlos Knippschild's avatar Carlos Knippschild Committed by Commit Bot

Revert "Improvements to autocomplete suggestion announcements"

This reverts commit 8de2c837.

Reason for revert:
Likely causing consistent failures in "Mac10.9 Tests (dbg)".
See: https://uberchromegw.corp.google.com/i/chromium.mac/builders/Mac10.9%20Tests%20%28dbg%29/builds/47340

Original change's description:
> Improvements to autocomplete suggestion announcements
> 
> Provide friendlier-sounding suggestions that are more efficient for screen reader use.
> 
> Bug: 785436
> Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
> Change-Id: Ifbf93609bc274f445e8ae81cccb5cb60a705da2e
> Reviewed-on: https://chromium-review.googlesource.com/772316
> Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Reviewed-by: Robert Flack <flackr@chromium.org>
> Reviewed-by: Justin Cohen <justincohen@chromium.org>
> Reviewed-by: Bret Sepulveda <bsep@chromium.org>
> Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
> Reviewed-by: Justin Donnelly <jdonnelly@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#517851}

TBR=ellyjones@chromium.org,flackr@chromium.org,jdonnelly@chromium.org,justincohen@chromium.org,rsesek@chromium.org,bsep@chromium.org,aleventhal@chromium.org

Change-Id: I31d7e24d7d7e9c2874763c27e4ecd53f349cdaaa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 785436
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/779920Reviewed-by: default avatarCarlos Knippschild <carlosk@chromium.org>
Commit-Queue: Carlos Knippschild <carlosk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517887}
parent b9059764
......@@ -10873,6 +10873,12 @@ For more information, visit our <ph name="BEGIN_LINK">&lt;a target="_blank" href
<message name="IDS_IME_API_NEVER_SHOW" desc="Checkbox that controls whether this bubble will be shown every time.">
Never show this again.
</message>
<if expr="is_macosx">
<message name="IDS_ANNOUNCEMENT_COMPLETION_AVAILABLE_MAC" desc="Text to be
read aloud to screenreader users to announce that a completion is available.">
Completion available: <ph name="COMPLETION_TEXT">$1</ph>
</message>
</if>
<!-- Ad Blocking UI strings. -->
<message name="IDS_ALWAYS_ALLOW_ADS" desc="Explanation associated with a toggle to allow ads after ads have been blocked on the page. To be used on pages where the ad blocking UI is governed by a persistent permissions-based whitelist.">
......
......@@ -79,7 +79,7 @@ class OmniboxViewMac : public OmniboxView,
void SetFocus() override;
void ApplyCaretVisibility() override;
void OnTemporaryTextMaybeChanged(const base::string16& display_text,
const AutocompleteMatch& match,
AutocompleteMatch::Type match_type,
bool save_original_selection,
bool notify_text_changed) override;
bool OnInlineAutocompleteTextMaybeChanged(const base::string16& display_text,
......
......@@ -598,7 +598,7 @@ void OmniboxViewMac::ApplyTextAttributes(
void OmniboxViewMac::OnTemporaryTextMaybeChanged(
const base::string16& display_text,
const AutocompleteMatch& match,
AutocompleteMatch::Type match_type,
bool save_original_selection,
bool notify_text_changed) {
if (save_original_selection)
......@@ -610,8 +610,7 @@ void OmniboxViewMac::OnTemporaryTextMaybeChanged(
[field_ clearUndoChain];
AnnounceAutocompleteForScreenReader(
AutocompleteMatchType::ToAccessibilityLabel(match.type, display_text,
match.description));
AutocompleteMatchType::ToAccessibilityLabel(match_type, display_text));
}
bool OmniboxViewMac::OnInlineAutocompleteTextMaybeChanged(
......@@ -1083,11 +1082,13 @@ bool OmniboxViewMac::IsCaretAtEnd() const {
void OmniboxViewMac::AnnounceAutocompleteForScreenReader(
const base::string16& display_text) {
NSString* announcement =
l10n_util::GetNSStringF(IDS_ANNOUNCEMENT_COMPLETION_AVAILABLE_MAC,
display_text);
NSDictionary* notification_info = @{
NSAccessibilityAnnouncementKey : base::SysUTF16ToNSString(display_text),
NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
NSAccessibilityAnnouncementKey : announcement,
NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
};
// We direct the screen reader to announce the friendly text.
NSAccessibilityPostNotificationWithUserInfo(
[field_ window],
NSAccessibilityAnnouncementRequestedNotification,
......
......@@ -471,7 +471,7 @@ void OmniboxViewViews::ApplyCaretVisibility() {
void OmniboxViewViews::OnTemporaryTextMaybeChanged(
const base::string16& display_text,
const AutocompleteMatch& match,
AutocompleteMatch::Type match_type,
bool save_original_selection,
bool notify_text_changed) {
if (save_original_selection)
......
......@@ -146,7 +146,7 @@ class OmniboxViewViews : public OmniboxView,
void UpdatePopup() override;
void ApplyCaretVisibility() override;
void OnTemporaryTextMaybeChanged(const base::string16& display_text,
const AutocompleteMatch& match,
AutocompleteMatch::Type match_type,
bool save_original_selection,
bool notify_text_changed) override;
bool OnInlineAutocompleteTextMaybeChanged(const base::string16& display_text,
......
......@@ -45,8 +45,7 @@ std::string AutocompleteMatchType::ToString(AutocompleteMatchType::Type type) {
base::string16 AutocompleteMatchType::ToAccessibilityLabel(
AutocompleteMatchType::Type type,
const base::string16& match_text,
const base::string16& additional_descriptive_text) {
const base::string16& descriptive_text) {
// Types with a message ID of zero get |text| returned as-is.
static constexpr int message_ids[] = {
0, // URL_WHAT_YOU_TYPED
......@@ -81,12 +80,11 @@ base::string16 AutocompleteMatchType::ToAccessibilityLabel(
0, // VOICE_SUGGEST
0, // PHYSICAL_WEB
0, // PHYSICAL_WEB_OVERFLOW
IDS_ACC_AUTOCOMPLETE_HISTORY, // TAB_SEARCH
0, // TAB_SEARCH
};
static_assert(arraysize(message_ids) == AutocompleteMatchType::NUM_TYPES,
"message_ids must have NUM_TYPES elements");
if (!message_ids[type])
return match_text;
return l10n_util::GetStringFUTF16(message_ids[type], match_text,
additional_descriptive_text);
return descriptive_text;
return l10n_util::GetStringFUTF16(message_ids[type], descriptive_text);
}
......@@ -67,13 +67,11 @@ struct AutocompleteMatchType {
static std::string ToString(AutocompleteMatchType::Type type);
// Returns the accessibility label for an AutocompleteMatch of type |type|
// whose text is |match_text| and which may have friendly descriptive text in
// |additional_descriptive_text_|. The accessibility label describes the
// whose text is |descriptive_text|. The accessibility label describes the
// match for use in a screenreader or other assistive technology.
static base::string16 ToAccessibilityLabel(
AutocompleteMatchType::Type type,
const base::string16& match_text,
const base::string16& additional_descriptive_text);
const base::string16& descriptive_text);
};
#endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_TYPE_H_
......@@ -10,13 +10,9 @@
TEST(AutocompleteMatchTypeTest, AccessibilityLabels) {
const base::string16& kTestUrl =
base::UTF8ToUTF16("https://www.chromium.org");
const base::string16& kTestTitle = base::UTF8ToUTF16("The Chromium Projects");
EXPECT_EQ(kTestUrl, AutocompleteMatchType::ToAccessibilityLabel(
AutocompleteMatchType::URL_WHAT_YOU_TYPED, kTestUrl,
kTestTitle));
EXPECT_EQ(kTestTitle + base::UTF8ToUTF16(" ") + kTestUrl +
base::UTF8ToUTF16(" location from history"),
AutocompleteMatchType::URL_WHAT_YOU_TYPED, kTestUrl));
EXPECT_EQ(base::UTF8ToUTF16("URL from history: ") + kTestUrl,
AutocompleteMatchType::ToAccessibilityLabel(
AutocompleteMatchType::HISTORY_URL, kTestUrl, kTestTitle));
AutocompleteMatchType::HISTORY_URL, kTestUrl));
}
......@@ -765,10 +765,11 @@ bool OmniboxEditModel::AcceptKeyword(
const AutocompleteMatch& match = CurrentMatch(nullptr);
original_url_ = match.destination_url;
view_->OnTemporaryTextMaybeChanged(MaybeStripKeyword(match.fill_into_edit),
match, save_original_selection, true);
match.type, save_original_selection,
true);
} else {
const AutocompleteMatch& match = CurrentMatch(nullptr);
view_->OnTemporaryTextMaybeChanged(user_text_, match, false, true);
view_->OnTemporaryTextMaybeChanged(user_text_, match.type, false, true);
}
base::RecordAction(base::UserMetricsAction("AcceptedKeywordHint"));
......@@ -1065,7 +1066,7 @@ void OmniboxEditModel::OnPopupDataChanged(
// right answer here :(
}
const AutocompleteMatch& match = CurrentMatch(nullptr);
view_->OnTemporaryTextMaybeChanged(MaybeStripKeyword(text), match,
view_->OnTemporaryTextMaybeChanged(MaybeStripKeyword(text), match.type,
save_original_selection, true);
return;
}
......
......@@ -63,7 +63,7 @@ class TestingOmniboxView : public OmniboxView {
void SetFocus() override {}
void ApplyCaretVisibility() override {}
void OnTemporaryTextMaybeChanged(const base::string16& display_text,
const AutocompleteMatch& match,
AutocompleteMatch::Type match_type,
bool save_original_selection,
bool notify_text_changed) override {
text_ = display_text;
......
......@@ -152,7 +152,7 @@ class OmniboxView {
// existing selection. |notify_text_changed| is true if the model should be
// notified of the change.
virtual void OnTemporaryTextMaybeChanged(const base::string16& display_text,
const AutocompleteMatch& match,
AutocompleteMatch::Type match_type,
bool save_original_selection,
bool notify_text_changed) = 0;
......
......@@ -57,21 +57,21 @@
These are parameterized on the text being completed into the omnibox.
-->
<message name="IDS_ACC_AUTOCOMPLETE_HISTORY" desc="Text for screenreaders describing a URL from history.">
<ph name="LOCATION_TITLE">$2<ex>The Chromium Projects</ex></ph> <ph name="SHORT_URL">$1<ex>www.chromium.org</ex> location from history</ph>
URL from history: <ph name="TEXT">$1<ex>https://www.chromium.org</ex></ph>
</message>
<message name="IDS_ACC_AUTOCOMPLETE_SEARCH_HISTORY" desc="Text for screenreaders describing a search from history.">
<ph name="TEXT">$1<ex>dogs</ex> search from history</ph>
Search from history for <ph name="TEXT">$1<ex>dogs</ex></ph>
</message>
<message name="IDS_ACC_AUTOCOMPLETE_SEARCH" desc="Text for screenreaders describing a generic search.">
<ph name="TEXT">$1<ex>dogs</ex> search</ph>
Search for <ph name="TEXT">$1<ex>dogs</ex></ph>
</message>
<message name="IDS_ACC_AUTOCOMPLETE_SUGGESTED_SEARCH" desc="Text for screenreaders describing a suggested search.">
<ph name="TEXT">$1<ex>dogs</ex> search suggestion</ph>
Suggested search for <ph name="TEXT">$1<ex>dogs</ex></ph>
</message>
<message name="IDS_ACC_AUTOCOMPLETE_BOOKMARK" desc="Text for screenreaders describing a URL from a bookmark.">
<ph name="LOCATION_TITLE">$2<ex>The Chromium Projects</ex></ph> <ph name="SHORT_URL">$1<ex>www.chromium.org</ex> bookmark</ph>
URL from bookmark: <ph name="TEXT">$1<ex>https://www.chromium.org</ex></ph>
</message>
<message name="IDS_ACC_AUTOCOMPLETE_CLIPBOARD" desc="Text for screenreaders describing a URL from a clipboard.">
<ph name="LOCATION_TITLE">$2<ex>The Chromium Projects</ex></ph> <ph name="SHORT_URL">$1<ex>www.chromium.org</ex> location from clipboard</ph>
URL from clipboard: <ph name="TEXT">$1<ex>https://www.chromium.org</ex></ph>
</message>
</grit-part>
......@@ -63,7 +63,7 @@ class OmniboxViewIOS : public OmniboxView,
void RevertAll() override;
void UpdatePopup() override;
void OnTemporaryTextMaybeChanged(const base::string16& display_text,
const AutocompleteMatch& match,
AutocompleteMatch::Type match_type,
bool save_original_selection,
bool notify_text_changed) override;
bool OnInlineAutocompleteTextMaybeChanged(const base::string16& display_text,
......
......@@ -262,7 +262,7 @@ void OmniboxViewIOS::UpdatePopup() {
void OmniboxViewIOS::OnTemporaryTextMaybeChanged(
const base::string16& display_text,
const AutocompleteMatch& match,
AutocompleteMatch::Type match_type,
bool save_original_selection,
bool notify_text_changed) {
SetWindowTextAndCaretPos(display_text, display_text.size(), false, false);
......
......@@ -261,5 +261,6 @@ IDS_UTILITY_PROCESS_EXTENSION_UNPACKER_NAME 360
IDS_AUTOCOMPLETE_SEARCH_DESCRIPTION 361
IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR 362
IDR_OVERLAY_DROP_SHADOW 363
IDS_EXTENSION_PROMPT_WARNING_CLIPBOARD_READWRITE 364
IDS_EXTENSION_PROMPT_WARNING_NOTIFICATIONS 365
IDS_ANNOUNCEMENT_COMPLETION_AVAILABLE_MAC 364
IDS_EXTENSION_PROMPT_WARNING_CLIPBOARD_READWRITE 365
IDS_EXTENSION_PROMPT_WARNING_NOTIFICATIONS 366
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment