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

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

Issue 23441024: Implement put_accvalue for textfields and location bar. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Switch to WeakPtrFactory 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
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 4b2dbd2e88f0ae63b660051489ca93acfe3f9197..faada7c08b2c0f853316ff96681727f2110cf3d2 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -190,7 +190,8 @@ LocationBarView::LocationBarView(Browser* browser,
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);
@@ -223,6 +224,7 @@ LocationBarView::~LocationBarView() {
template_url_service_->RemoveObserver(this);
if (browser_)
browser_->search_model()->RemoveObserver(this);
+ weak_ptr_factory_.InvalidateWeakPtrs();
sky 2013/09/04 16:20:12 Is there a reason you're explicitly invoking this?
dmazzoni 2013/09/04 17:16:18 It's sometimes safer, as they might not be invalid
}
// static
@@ -1300,6 +1302,10 @@ void LocationBarView::PaintPageActionBackgrounds(gfx::Canvas* canvas) {
}
}
+void LocationBarView::AccessibilitySetValue(const string16& new_value) {
sky 2013/09/04 16:20:12 Make position match header.
dmazzoni 2013/09/04 17:16:18 The order was all over the place. I moved all of t
+ location_entry_->SetUserText(new_value);
sky 2013/09/04 16:20:12 Does this need to do nothing if is_popup_mode_, or
dmazzoni 2013/09/04 17:16:18 Good idea, I'll set the readonly flag if is_popup_
+}
+
const char* LocationBarView::GetClassName() const {
return kViewClassName;
}
@@ -1332,6 +1338,9 @@ bool LocationBarView::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
}
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();
@@ -1341,6 +1350,10 @@ void LocationBarView::GetAccessibleState(ui::AccessibleViewState* state) {
location_entry_->GetSelectionBounds(&entry_start, &entry_end);
state->selection_start = entry_start;
state->selection_end = entry_end;
+
+ state->set_value_callback =
+ base::Bind(&LocationBarView::AccessibilitySetValue,
+ weak_ptr_factory_.GetWeakPtr());
}
bool LocationBarView::HasFocus() const {

Powered by Google App Engine
This is Rietveld 408576698