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

Side by Side 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: Add test, address feedback 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 unified diff | Download patch
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 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 // mid-point between two page actions in the bounding rectangle. For even 1293 // mid-point between two page actions in the bounding rectangle. For even
1294 // paddings, the +1 is dropped, which is right since there is no pixel at 1294 // paddings, the +1 is dropped, which is right since there is no pixel at
1295 // the mid-point. 1295 // the mid-point.
1296 bounds.Inset(-(horizontal_padding + 1) / 2, 0); 1296 bounds.Inset(-(horizontal_padding + 1) / 2, 0);
1297 location_bar_util::PaintExtensionActionBackground( 1297 location_bar_util::PaintExtensionActionBackground(
1298 *(*page_action_view)->image_view()->page_action(), 1298 *(*page_action_view)->image_view()->page_action(),
1299 tab_id, canvas, bounds, text_color, background_color); 1299 tab_id, canvas, bounds, text_color, background_color);
1300 } 1300 }
1301 } 1301 }
1302 1302
1303 void LocationBarView::AccessibilitySetValue(const string16& new_value) {
1304 location_entry_->SetUserText(new_value);
1305 }
1306
1303 const char* LocationBarView::GetClassName() const { 1307 const char* LocationBarView::GetClassName() const {
1304 return kViewClassName; 1308 return kViewClassName;
1305 } 1309 }
1306 1310
1307 bool LocationBarView::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { 1311 bool LocationBarView::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
1308 #if defined(OS_WIN) 1312 #if defined(OS_WIN)
1309 if (views::FocusManager::IsTabTraversalKeyEvent(event)) { 1313 if (views::FocusManager::IsTabTraversalKeyEvent(event)) {
1310 if (location_entry_->model()->popup_model()->IsOpen()) { 1314 if (location_entry_->model()->popup_model()->IsOpen()) {
1311 // Return true so that the edit sees the tab and moves the selection. 1315 // Return true so that the edit sees the tab and moves the selection.
1312 return true; 1316 return true;
(...skipping 21 matching lines...) Expand all
1334 void LocationBarView::GetAccessibleState(ui::AccessibleViewState* state) { 1338 void LocationBarView::GetAccessibleState(ui::AccessibleViewState* state) {
1335 state->role = ui::AccessibilityTypes::ROLE_LOCATION_BAR; 1339 state->role = ui::AccessibilityTypes::ROLE_LOCATION_BAR;
1336 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); 1340 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION);
1337 state->value = location_entry_->GetText(); 1341 state->value = location_entry_->GetText();
1338 1342
1339 string16::size_type entry_start; 1343 string16::size_type entry_start;
1340 string16::size_type entry_end; 1344 string16::size_type entry_end;
1341 location_entry_->GetSelectionBounds(&entry_start, &entry_end); 1345 location_entry_->GetSelectionBounds(&entry_start, &entry_end);
1342 state->selection_start = entry_start; 1346 state->selection_start = entry_start;
1343 state->selection_end = entry_end; 1347 state->selection_end = entry_end;
1348
1349 state->set_value_callback =
1350 base::Bind(&LocationBarView::AccessibilitySetValue, AsWeakPtr());
1344 } 1351 }
1345 1352
1346 bool LocationBarView::HasFocus() const { 1353 bool LocationBarView::HasFocus() const {
1347 return location_entry_->model()->has_focus(); 1354 return location_entry_->model()->has_focus();
1348 } 1355 }
1349 1356
1350 void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 1357 void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
1351 if (browser_ && browser_->instant_controller() && parent()) 1358 if (browser_ && browser_->instant_controller() && parent())
1352 browser_->instant_controller()->SetOmniboxBounds(bounds()); 1359 browser_->instant_controller()->SetOmniboxBounds(bounds());
1353 OmniboxPopupView* popup = location_entry_->model()->popup_model()->view(); 1360 OmniboxPopupView* popup = location_entry_->model()->popup_model()->view();
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1560 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1554 int total_height = 1561 int total_height =
1555 use_preferred_size ? GetPreferredSize().height() : height(); 1562 use_preferred_size ? GetPreferredSize().height() : height();
1556 return std::max(total_height - (vertical_edge_thickness() * 2), 0); 1563 return std::max(total_height - (vertical_edge_thickness() * 2), 0);
1557 } 1564 }
1558 1565
1559 bool LocationBarView::HasValidSuggestText() const { 1566 bool LocationBarView::HasValidSuggestText() const {
1560 return suggested_text_view_->visible() && 1567 return suggested_text_view_->visible() &&
1561 !suggested_text_view_->size().IsEmpty(); 1568 !suggested_text_view_->size().IsEmpty();
1562 } 1569 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698