summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/input_method/delayable_widget.h
blob: 8b4846c40709b4b6229e9aadd2b864deb3809c46 (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
// 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.

#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_DELAYABLE_WIDGET_H_
#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_DELAYABLE_WIDGET_H_

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

namespace chromeos {
namespace input_method {

// This class implements widget which can show/hide with given delay.
class DelayableWidget : public views::Widget {
 public:
  DelayableWidget();
  virtual ~DelayableWidget();

  // Shows window.
  virtual void Show() OVERRIDE;

  // Shows window after |milliseconds| milli secs. This function can be called
  // in the DelayShow/DelayHide delay duration. In such case, previous operation
  // will be cancelled.
  void DelayShow(unsigned int milliseconds);

  // Hides window.
  void Hide();

  // Hides window after |milliseconds| milli secs. This function can be called
  // in the DelayShow/DelayHide delay duration. In such case, previous operation
  // will be cancelled.
  void DelayHide(unsigned int milliseconds);

 private:
  base::OneShotTimer<DelayableWidget> show_hide_timer_;

  DISALLOW_COPY_AND_ASSIGN(DelayableWidget);
};

}  // namespace input_method
}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_DELAYABLE_WIDGET_H_