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 3 // found in the LICENSE file. 4 5 #include "chrome/browser/chromeos/input_method/delayable_widget.h" 6 7 #include "ui/views/widget/widget.h" 8 9 namespace chromeos { 10 namespace input_method { 11 DelayableWidget()12DelayableWidget::DelayableWidget() { 13 } 14 ~DelayableWidget()15DelayableWidget::~DelayableWidget() { 16 show_hide_timer_.Stop(); 17 } 18 Show()19void DelayableWidget::Show() { 20 show_hide_timer_.Stop(); 21 views::Widget::Show(); 22 } 23 DelayShow(unsigned int milliseconds)24void DelayableWidget::DelayShow(unsigned int milliseconds) { 25 show_hide_timer_.Stop(); 26 show_hide_timer_.Start(FROM_HERE, 27 base::TimeDelta::FromMilliseconds(milliseconds), 28 this, 29 &DelayableWidget::Show); 30 } 31 Hide()32void DelayableWidget::Hide() { 33 show_hide_timer_.Stop(); 34 views::Widget::Hide(); 35 } 36 DelayHide(unsigned int milliseconds)37void DelayableWidget::DelayHide(unsigned int milliseconds) { 38 show_hide_timer_.Stop(); 39 show_hide_timer_.Start(FROM_HERE, 40 base::TimeDelta::FromMilliseconds(milliseconds), 41 this, 42 &DelayableWidget::Hide); 43 } 44 45 } // namespace input_method 46 } // namespace chromeos 47