Index: ui/views/controls/textfield/textfield.cc |
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc |
index 4642d23fc89a89633cc84ff72fbb5011959a7b9d..3639b883b68735affec8e871bbb517c0d9018645 100644 |
--- a/ui/views/controls/textfield/textfield.cc |
+++ b/ui/views/controls/textfield/textfield.cc |
@@ -33,6 +33,7 @@ |
#include "ui/native_theme/native_theme.h" |
#include "ui/strings/grit/ui_strings.h" |
#include "ui/views/background.h" |
+#include "ui/views/controls/focus_ring.h" |
#include "ui/views/controls/focusable_border.h" |
#include "ui/views/controls/label.h" |
#include "ui/views/controls/menu/menu_runner.h" |
@@ -260,12 +261,17 @@ Textfield::Textfield() |
aggregated_clicks_(0), |
drag_start_display_offset_(0), |
touch_handles_hidden_due_to_scroll_(false), |
+ focus_ring_(nullptr), |
weak_ptr_factory_(this) { |
set_context_menu_controller(this); |
set_drag_controller(this); |
GetRenderText()->SetFontList(GetDefaultFontList()); |
SetBorder(std::unique_ptr<Border>(new FocusableBorder())); |
SetFocusBehavior(FocusBehavior::ALWAYS); |
+ if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
+ focus_ring_ = new FocusRing(); |
+ AddChildView(focus_ring_); |
+ } |
// These allow BrowserView to pass edit commands from the Chrome menu to us |
// when we're focused by simply asking the FocusManager to |
@@ -990,6 +996,8 @@ void Textfield::OnFocus() { |
StartBlinkingCursor(); |
View::OnFocus(); |
SchedulePaint(); |
+ if (ui::MaterialDesignController::IsSecondaryUiMaterial()) |
+ focus_ring_->SetVisible(true); |
} |
void Textfield::OnBlur() { |
@@ -1007,6 +1015,8 @@ void Textfield::OnBlur() { |
// Border typically draws focus indicator. |
SchedulePaint(); |
+ if (ui::MaterialDesignController::IsSecondaryUiMaterial()) |
+ focus_ring_->SetVisible(false); |
sky
2016/10/03 23:53:15
Similar comment about deleting here.
|
} |
gfx::Point Textfield::GetKeyboardContextMenuLocation() { |