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

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

Issue 2817022: Small tweaks to improve toolbar keyboard accessibility: Put focus rects... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 6 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/views/location_bar/location_bar_view.cc
===================================================================
--- chrome/browser/views/location_bar/location_bar_view.cc (revision 50343)
+++ chrome/browser/views/location_bar/location_bar_view.cc (working copy)
@@ -8,6 +8,7 @@
#include <gtk/gtk.h>
#endif
+#include "app/l10n_util.h"
sky 2010/06/21 20:55:32 after app/drag...
#include "app/drag_drop_types.h"
#include "app/resource_bundle.h"
#include "app/theme_provider.h"
@@ -29,6 +30,7 @@
#include "gfx/canvas.h"
#include "gfx/color_utils.h"
#include "gfx/skia_util.h"
+#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "views/drag_utils.h"
@@ -42,6 +44,8 @@
const int LocationBarView::kVertMargin = 2;
const int LocationBarView::kEdgeThickness = 2;
const int LocationBarView::kItemPadding = 3;
+const char LocationBarView::kViewClassName[] =
+ "browser/views/location_bar/LocationBarView";
// Convenience: Total space at the edges of the bar.
const int kEdgePadding =
@@ -94,6 +98,7 @@
star_view_(NULL),
mode_(mode),
force_hidden_count_(0),
+ show_focus_rect_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(first_run_bubble_(this)) {
DCHECK(profile_);
SetID(VIEW_ID_LOCATION_BAR);
@@ -155,6 +160,8 @@
AddChildView(location_entry_view_);
location_entry_view_->set_focus_view(this);
location_entry_view_->Attach(location_entry_->GetNativeView());
+ location_entry_view_->SetAccessibleName(
+ l10n_util::GetString(IDS_ACCNAME_LOCATION));
selected_keyword_view_ =
new SelectedKeywordView(kSelectedKeywordBackgroundImages,
@@ -554,6 +561,11 @@
canvas->FillRectInt(color, bounds.x(), bounds.y(), bounds.width(),
bounds.height());
}
+
+ if (show_focus_rect_ && HasFocus()) {
+ gfx::Rect r = location_entry_view_->bounds();
+ canvas->DrawFocusRect(r.x() - 1, r.y(), r.width() + 2, r.height());
sky 2010/06/21 20:55:32 Make sure this works for rtl.
+ }
}
void LocationBarView::VisibleBoundsInRootChanged() {
@@ -839,6 +851,10 @@
#endif
}
+std::string LocationBarView::GetClassName() const {
+ return kViewClassName;
+}
+
bool LocationBarView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) {
if (keyword_hint_view_->IsVisible() &&
views::FocusManager::IsTabTraversalKeyEvent(e)) {

Powered by Google App Engine
This is Rietveld 408576698