summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/input_method/delayable_widget.cc
blob: 9a8554653003073e9e8db44f5298f0c3099ff733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/input_method/delayable_widget.h"

#include "ui/views/widget/widget.h"

namespace chromeos {
namespace input_method {

DelayableWidget::DelayableWidget() {
}

DelayableWidget::~DelayableWidget() {
  show_hide_timer_.Stop();
}

void DelayableWidget::Show() {
  show_hide_timer_.Stop();
  views::Widget::Show();
}

void DelayableWidget::DelayShow(unsigned int milliseconds) {
  show_hide_timer_.Stop();
  show_hide_timer_.Start(FROM_HERE,
                         base::TimeDelta::FromMilliseconds(milliseconds),
                         this,
                         &DelayableWidget::Show);
}

void DelayableWidget::Hide() {
  show_hide_timer_.Stop();
  views::Widget::Hide();
}

void DelayableWidget::DelayHide(unsigned int milliseconds) {
  show_hide_timer_.Stop();
  show_hide_timer_.Start(FROM_HERE,
                         base::TimeDelta::FromMilliseconds(milliseconds),
                         this,
                         &DelayableWidget::Hide);
}

}  // namespace input_method
}  // namespace chromeos