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

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

Issue 10026013: Update use of TimeDelta in chrome/browser/*, ui/views/*, and other places. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove debug comment. Created 8 years, 7 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/native_textfield_views.h" 5 #include "ui/views/controls/textfield/native_textfield_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 void NativeTextfieldViews::HandleFocus() { 500 void NativeTextfieldViews::HandleFocus() {
501 GetRenderText()->set_focused(true); 501 GetRenderText()->set_focused(true);
502 is_cursor_visible_ = true; 502 is_cursor_visible_ = true;
503 SchedulePaint(); 503 SchedulePaint();
504 OnCaretBoundsChanged(); 504 OnCaretBoundsChanged();
505 // Start blinking cursor. 505 // Start blinking cursor.
506 MessageLoop::current()->PostDelayedTask( 506 MessageLoop::current()->PostDelayedTask(
507 FROM_HERE, 507 FROM_HERE,
508 base::Bind(&NativeTextfieldViews::UpdateCursor, 508 base::Bind(&NativeTextfieldViews::UpdateCursor,
509 cursor_timer_.GetWeakPtr()), 509 cursor_timer_.GetWeakPtr()),
510 kCursorVisibleTimeMs); 510 base::TimeDelta::FromMilliseconds(kCursorVisibleTimeMs));
511 } 511 }
512 512
513 void NativeTextfieldViews::HandleBlur() { 513 void NativeTextfieldViews::HandleBlur() {
514 GetRenderText()->set_focused(false); 514 GetRenderText()->set_focused(false);
515 // Stop blinking cursor. 515 // Stop blinking cursor.
516 cursor_timer_.InvalidateWeakPtrs(); 516 cursor_timer_.InvalidateWeakPtrs();
517 if (is_cursor_visible_) { 517 if (is_cursor_visible_) {
518 is_cursor_visible_ = false; 518 is_cursor_visible_ = false;
519 RepaintCursor(); 519 RepaintCursor();
520 } 520 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 base::i18n::ToLower(text) : text; 800 base::i18n::ToLower(text) : text;
801 } 801 }
802 802
803 void NativeTextfieldViews::UpdateCursor() { 803 void NativeTextfieldViews::UpdateCursor() {
804 is_cursor_visible_ = !is_cursor_visible_; 804 is_cursor_visible_ = !is_cursor_visible_;
805 RepaintCursor(); 805 RepaintCursor();
806 MessageLoop::current()->PostDelayedTask( 806 MessageLoop::current()->PostDelayedTask(
807 FROM_HERE, 807 FROM_HERE,
808 base::Bind(&NativeTextfieldViews::UpdateCursor, 808 base::Bind(&NativeTextfieldViews::UpdateCursor,
809 cursor_timer_.GetWeakPtr()), 809 cursor_timer_.GetWeakPtr()),
810 is_cursor_visible_ ? kCursorVisibleTimeMs : kCursorInvisibleTimeMs); 810 base::TimeDelta::FromMilliseconds(
811 is_cursor_visible_ ? kCursorVisibleTimeMs : kCursorInvisibleTimeMs));
811 } 812 }
812 813
813 void NativeTextfieldViews::RepaintCursor() { 814 void NativeTextfieldViews::RepaintCursor() {
814 gfx::Rect r(GetCaretBounds()); 815 gfx::Rect r(GetCaretBounds());
815 r.Inset(-1, -1, -1, -1); 816 r.Inset(-1, -1, -1, -1);
816 SchedulePaintInRect(r); 817 SchedulePaintInRect(r);
817 } 818 }
818 819
819 void NativeTextfieldViews::PaintTextAndCursor(gfx::Canvas* canvas) { 820 void NativeTextfieldViews::PaintTextAndCursor(gfx::Canvas* canvas) {
820 TRACE_EVENT0("views", "NativeTextfieldViews::PaintTextAndCursor"); 821 TRACE_EVENT0("views", "NativeTextfieldViews::PaintTextAndCursor");
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 1140
1140 #if defined(USE_AURA) 1141 #if defined(USE_AURA)
1141 // static 1142 // static
1142 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( 1143 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper(
1143 Textfield* field) { 1144 Textfield* field) {
1144 return new NativeTextfieldViews(field); 1145 return new NativeTextfieldViews(field);
1145 } 1146 }
1146 #endif 1147 #endif
1147 1148
1148 } // namespace views 1149 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698