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

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 902783006: Mask the value of passwords in accessible value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile Created 5 years, 10 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 "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "ui/accessibility/ax_view_state.h" 10 #include "ui/accessibility/ax_view_state.h"
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 void Textfield::OnDragDone() { 907 void Textfield::OnDragDone() {
908 initiating_drag_ = false; 908 initiating_drag_ = false;
909 drop_cursor_visible_ = false; 909 drop_cursor_visible_ = false;
910 } 910 }
911 911
912 void Textfield::GetAccessibleState(ui::AXViewState* state) { 912 void Textfield::GetAccessibleState(ui::AXViewState* state) {
913 state->role = ui::AX_ROLE_TEXT_FIELD; 913 state->role = ui::AX_ROLE_TEXT_FIELD;
914 state->name = accessible_name_; 914 state->name = accessible_name_;
915 if (read_only()) 915 if (read_only())
916 state->AddStateFlag(ui::AX_STATE_READ_ONLY); 916 state->AddStateFlag(ui::AX_STATE_READ_ONLY);
917 if (text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD) 917 if (text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD) {
918 state->AddStateFlag(ui::AX_STATE_PROTECTED); 918 state->AddStateFlag(ui::AX_STATE_PROTECTED);
919 state->value = text(); 919 state->value = base::string16(text().size(), '*');
920 920 } else {
921 state->value = text();
922 }
921 const gfx::Range range = GetSelectedRange(); 923 const gfx::Range range = GetSelectedRange();
922 state->selection_start = range.start(); 924 state->selection_start = range.start();
923 state->selection_end = range.end(); 925 state->selection_end = range.end();
924 926
925 if (!read_only()) { 927 if (!read_only()) {
926 state->set_value_callback = 928 state->set_value_callback =
927 base::Bind(&Textfield::AccessibilitySetValue, 929 base::Bind(&Textfield::AccessibilitySetValue,
928 weak_ptr_factory_.GetWeakPtr()); 930 weak_ptr_factory_.GetWeakPtr());
929 } 931 }
930 } 932 }
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 const size_t length = selection_clipboard_text.length(); 1871 const size_t length = selection_clipboard_text.length();
1870 range = gfx::Range(range.start() + length, range.end() + length); 1872 range = gfx::Range(range.start() + length, range.end() + length);
1871 } 1873 }
1872 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); 1874 model_->MoveCursorTo(gfx::SelectionModel(range, affinity));
1873 UpdateAfterChange(true, true); 1875 UpdateAfterChange(true, true);
1874 OnAfterUserAction(); 1876 OnAfterUserAction();
1875 } 1877 }
1876 } 1878 }
1877 1879
1878 } // namespace views 1880 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698