blob: d7a473fef2e2c838273aae64ff477d29dc2676b8 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 | // 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 ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_
#define ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_
#include <vector>
#include "ash/content_support/ash_with_content_export.h"
#include "ash/wm/overlay_event_filter.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "ui/views/controls/webview/web_dialog_view.h"
class GURL;
namespace content {
class BrowserContext;
}
namespace ui {
class WebDialogDelegate;
}
namespace ash {
// A customized dialog view for the keyboard overlay.
class ASH_WITH_CONTENT_EXPORT KeyboardOverlayView
    : public views::WebDialogView,
      public ash::OverlayEventFilter::Delegate {
 public:
  struct KeyEventData {
    ui::KeyboardCode key_code;
    int flags;
  };
  KeyboardOverlayView(content::BrowserContext* context,
                      ui::WebDialogDelegate* delegate,
                      WebContentsHandler* handler);
  ~KeyboardOverlayView() override;
  // Overridden from ash::OverlayEventFilter::Delegate:
  void Cancel() override;
  bool IsCancelingKeyEvent(ui::KeyEvent* event) override;
  aura::Window* GetWindow() override;
  // Shows the keyboard overlay.
  static void ShowDialog(content::BrowserContext* context,
                         WebContentsHandler* handler,
                         const GURL& url);
 private:
  FRIEND_TEST_ALL_PREFIXES(KeyboardOverlayViewTest, OpenAcceleratorsClose);
  FRIEND_TEST_ALL_PREFIXES(KeyboardOverlayViewTest, NoRedundantCancelingKeys);
  // Overridden from views::WidgetDelegate:
  void WindowClosing() override;
  static void GetCancelingKeysForTesting(
      std::vector<KeyEventData>* canceling_keys);
  DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayView);
};
}  // namespace ash
#endif  // ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_VIEW_H_
 |