1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_APPS_DESKTOP_KEYBOARD_CAPTURE_H_
6 #define CHROME_BROWSER_UI_VIEWS_APPS_DESKTOP_KEYBOARD_CAPTURE_H_
8 #include "ui/views/widget/widget.h"
9 #include "ui/views/widget/widget_observer.h"
11 // This class installs/uninstalls keyboard hook as the widget activation
13 class DesktopKeyboardCapture
: public views::WidgetObserver
{
15 explicit DesktopKeyboardCapture(views::Widget
* widget
);
16 ~DesktopKeyboardCapture() override
;
19 // views::WidgetObserver implementation.
20 void OnWidgetActivationChanged(views::Widget
* widget
, bool active
) override
;
22 void RegisterKeyboardHooks();
23 void DeregisterKeyboardHooks();
25 // The widget registering for keyboard intercept. Weak reference.
26 views::Widget
* widget_
;
28 // Current state of keyboard intercept registration.
31 DISALLOW_COPY_AND_ASSIGN(DesktopKeyboardCapture
);
34 #endif // CHROME_BROWSER_UI_VIEWS_APPS_DESKTOP_KEYBOARD_CAPTURE_H_