Home | History | Annotate | Download | only in input_method
      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 
     12 DelayableWidget::DelayableWidget() {
     13 }
     14 
     15 DelayableWidget::~DelayableWidget() {
     16   show_hide_timer_.Stop();
     17 }
     18 
     19 void DelayableWidget::Show() {
     20   show_hide_timer_.Stop();
     21   views::Widget::Show();
     22 }
     23 
     24 void 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 
     32 void DelayableWidget::Hide() {
     33   show_hide_timer_.Stop();
     34   views::Widget::Hide();
     35 }
     36 
     37 void 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