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 6b4235d1f1b8bcacf45da01c17582ccdf9de49a4..83f13ff9a51c2146441888ec0d145fabd64d9405 100644 |
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc |
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
@@ -1258,16 +1258,31 @@ void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
} |
void LocationBarView::OnFocus() { |
- // Explicitly focus the omnibox so a focus ring will be displayed around it on |
- // Windows. |
omnibox_view_->SetFocus(); |
} |
+void LocationBarView::OnBlur() { |
+ SchedulePaint(); |
sky
2016/05/20 16:08:00
Is this only necessary if modematerial and show_fo
Evan Stade
2016/05/20 18:02:00
hmm, turns out this didn't actually work (although
|
+} |
+ |
void LocationBarView::OnPaint(gfx::Canvas* canvas) { |
View::OnPaint(canvas); |
- if (ui::MaterialDesignController::IsModeMaterial() && !is_popup_mode_) |
- return; // The background and border are painted by our Background. |
+ if (ui::MaterialDesignController::IsModeMaterial()) { |
+ if (show_focus_rect_ && HasFocus()) { |
+ SkPaint paint; |
+ paint.setAntiAlias(true); |
+ paint.setColor(GetNativeTheme()->GetSystemColor( |
+ ui::NativeTheme::NativeTheme::kColorId_FocusedBorderColor)); |
+ paint.setStyle(SkPaint::kStroke_Style); |
+ paint.setStrokeWidth(1); |
+ gfx::RectF focus_rect(GetLocalBounds()); |
+ focus_rect.Inset(gfx::InsetsF(0.5f)); |
+ canvas->DrawRoundRect(focus_rect, 2.5f, paint); |
+ } |
+ if (!is_popup_mode_) |
+ return; // The background and border are painted by our Background. |
+ } |
// Fill the location bar background color behind the border. Parts of the |
// border images are meant to rest atop the toolbar background and parts atop |
@@ -1302,8 +1317,10 @@ void LocationBarView::PaintChildren(const ui::PaintContext& context) { |
// the focus rect to appear on top of children we paint here rather than |
// OnPaint(). |
// Note: |Canvas::DrawFocusRect| paints a dashed rect with gray color. |
- if (show_focus_rect_ && HasFocus()) |
+ if (!ui::MaterialDesignController::IsModeMaterial() && show_focus_rect_ && |
+ HasFocus()) { |
recorder.canvas()->DrawFocusRect(omnibox_view_->bounds()); |
+ } |
if (!ui::MaterialDesignController::IsModeMaterial() && !is_popup_mode_) { |
views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), |