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 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_DELAYABLE_WIDGET_H_ 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_DELAYABLE_WIDGET_H_ 7 8 #include "base/timer/timer.h" 9 #include "ui/views/widget/widget.h" 10 11 namespace chromeos { 12 namespace input_method { 13 14 // This class implements widget which can show/hide with given delay. 15 class DelayableWidget : public views::Widget { 16 public: 17 DelayableWidget(); 18 virtual ~DelayableWidget(); 19 20 // Shows window. 21 virtual void Show() OVERRIDE; 22 23 // Shows window after |milliseconds| milli secs. This function can be called 24 // in the DelayShow/DelayHide delay duration. In such case, previous operation 25 // will be cancelled. 26 void DelayShow(unsigned int milliseconds); 27 28 // Hides window. 29 void Hide(); 30 31 // Hides window after |milliseconds| milli secs. This function can be called 32 // in the DelayShow/DelayHide delay duration. In such case, previous operation 33 // will be cancelled. 34 void DelayHide(unsigned int milliseconds); 35 36 private: 37 base::OneShotTimer<DelayableWidget> show_hide_timer_; 38 39 DISALLOW_COPY_AND_ASSIGN(DelayableWidget); 40 }; 41 42 } // namespace input_method 43 } // namespace chromeos 44 45 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_DELAYABLE_WIDGET_H_ 46