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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 23983039: Merge 221688 "Implement put_accvalue for textfields and location..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1599/src/
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
===================================================================
--- chrome/browser/ui/views/location_bar/location_bar_view.cc (revision 223520)
+++ chrome/browser/ui/views/location_bar/location_bar_view.cc (working copy)
@@ -192,7 +192,8 @@
is_popup_mode_(is_popup_mode),
show_focus_rect_(false),
template_url_service_(NULL),
- animation_offset_(0) {
+ animation_offset_(0),
+ weak_ptr_factory_(this) {
if (!views::Textfield::IsViewsTextfieldEnabled())
set_id(VIEW_ID_OMNIBOX);
@@ -1320,6 +1321,9 @@
}
void LocationBarView::GetAccessibleState(ui::AccessibleViewState* state) {
+ if (!location_entry_)
+ return;
+
state->role = ui::AccessibilityTypes::ROLE_LOCATION_BAR;
state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION);
state->value = location_entry_->GetText();
@@ -1329,6 +1333,14 @@
location_entry_->GetSelectionBounds(&entry_start, &entry_end);
state->selection_start = entry_start;
state->selection_end = entry_end;
+
+ if (is_popup_mode_) {
+ state->state |= ui::AccessibilityTypes::STATE_READONLY;
+ } else {
+ state->set_value_callback =
+ base::Bind(&LocationBarView::AccessibilitySetValue,
+ weak_ptr_factory_.GetWeakPtr());
+ }
}
bool LocationBarView::HasFocus() const {
@@ -1548,3 +1560,7 @@
return suggested_text_view_->visible() &&
!suggested_text_view_->size().IsEmpty();
}
+
+void LocationBarView::AccessibilitySetValue(const string16& new_value) {
+ location_entry_->SetUserText(new_value);
+}

Powered by Google App Engine
This is Rietveld 408576698