Home | History | Annotate | Download | only in views
      1 // Copyright (c) 2011 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_UI_VIEWS_KEYBOARD_OVERLAY_DIALOG_VIEW_H_
      6 #define CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DIALOG_VIEW_H_
      7 #pragma once
      8 
      9 #include <set>
     10 
     11 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h"
     12 #include "chrome/browser/ui/webui/html_dialog_ui.h"
     13 #include "chrome/browser/ui/views/html_dialog_view.h"
     14 #include "views/window/window_delegate.h"
     15 
     16 class BrowserView;
     17 
     18 // A customized dialog view for the keyboard overlay.
     19 class KeyboardOverlayDialogView : public HtmlDialogView {
     20  public:
     21   KeyboardOverlayDialogView(Profile* profile,
     22                             HtmlDialogUIDelegate* delegate,
     23                             BrowserView* parent_view);
     24   virtual ~KeyboardOverlayDialogView();
     25 
     26   // Initializes the contents of the dialog (the DOMView and the callbacks).
     27   void InitDialog();
     28 
     29   // Overridden from views::View:
     30   virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
     31 
     32   // Shows the keyboard overlay.
     33   static void ShowDialog(gfx::NativeWindow owning_window, BrowserView* parent);
     34 
     35  private:
     36   // Returns true if |accelerator| is an accelerator for closing the dialog.
     37   bool IsCloseAccelerator(const views::Accelerator& accelerator);
     38 
     39   // Points to the view from which this dialog is created.
     40   BrowserView* parent_view_;
     41 
     42   // Contains accelerators for closing this dialog.
     43   std::set<views::Accelerator> close_accelerators_;
     44 
     45   DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayDialogView);
     46 };
     47 
     48 #endif  // CHROME_BROWSER_UI_VIEWS_KEYBOARD_OVERLAY_DIALOG_VIEW_H_
     49