summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/keyboard_overlay_dialog_view.h
blob: ff0d95fe3362c7e09cd00a04b965b3b5c5126816 (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) 2011 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_UI_VIEWS_KEYBOARD_OVERLAY_DIALOG_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DIALOG_VIEW_H_
#pragma once

#include <set>

#include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h"
#include "chrome/browser/ui/webui/html_dialog_ui.h"
#include "chrome/browser/ui/views/html_dialog_view.h"

class BrowserView;

// A customized dialog view for the keyboard overlay.
class KeyboardOverlayDialogView : public HtmlDialogView {
 public:
  KeyboardOverlayDialogView(Profile* profile,
                            HtmlDialogUIDelegate* delegate,
                            BrowserView* parent_view);
  virtual ~KeyboardOverlayDialogView();

  // Overridden from views::View:
  virtual bool AcceleratorPressed(const views::Accelerator& accelerator);

  // Shows the keyboard overlay.
  static void ShowDialog(gfx::NativeWindow owning_window, BrowserView* parent);

 private:
  virtual void RegisterDialogAccelerators() OVERRIDE;

  // Returns true if |accelerator| is an accelerator for closing the dialog.
  bool IsCloseAccelerator(const views::Accelerator& accelerator);

  // Points to the view from which this dialog is created.
  BrowserView* parent_view_;

  // Contains accelerators for closing this dialog.
  std::set<views::Accelerator> close_accelerators_;

  DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayDialogView);
};

#endif  // CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DIALOG_VIEW_H_