Home | History | Annotate | Download | only in views
      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_UI_VIEWS_JAVASCRIPT_APP_MODAL_DIALOG_VIEWS_H_
      6 #define CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_DIALOG_VIEWS_H_
      7 
      8 #include "base/memory/scoped_ptr.h"
      9 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
     10 #include "ui/views/window/dialog_delegate.h"
     11 
     12 class JavaScriptAppModalDialog;
     13 
     14 #if defined(USE_X11) && !defined(OS_CHROMEOS)
     15 class JavascriptAppModalEventBlockerX11;
     16 #endif
     17 
     18 namespace views {
     19 class MessageBoxView;
     20 }
     21 
     22 class JavaScriptAppModalDialogViews : public NativeAppModalDialog,
     23                                       public views::DialogDelegate {
     24  public:
     25   explicit JavaScriptAppModalDialogViews(JavaScriptAppModalDialog* parent);
     26   virtual ~JavaScriptAppModalDialogViews();
     27 
     28   // Overridden from NativeAppModalDialog:
     29   virtual int GetAppModalDialogButtons() const OVERRIDE;
     30   virtual void ShowAppModalDialog() OVERRIDE;
     31   virtual void ActivateAppModalDialog() OVERRIDE;
     32   virtual void CloseAppModalDialog() OVERRIDE;
     33   virtual void AcceptAppModalDialog() OVERRIDE;
     34   virtual void CancelAppModalDialog() OVERRIDE;
     35 
     36   // Overridden from views::DialogDelegate:
     37   virtual int GetDefaultDialogButton() const OVERRIDE;
     38   virtual int GetDialogButtons() const OVERRIDE;
     39   virtual base::string16 GetWindowTitle() const OVERRIDE;
     40   virtual void WindowClosing() OVERRIDE;
     41   virtual void DeleteDelegate() OVERRIDE;
     42   virtual bool Cancel() OVERRIDE;
     43   virtual bool Accept() OVERRIDE;
     44   virtual base::string16 GetDialogButtonLabel(
     45       ui::DialogButton button) const OVERRIDE;
     46 
     47   // Overridden from views::WidgetDelegate:
     48   virtual ui::ModalType GetModalType() const OVERRIDE;
     49   virtual views::View* GetContentsView() OVERRIDE;
     50   virtual views::View* GetInitiallyFocusedView() OVERRIDE;
     51   virtual void OnClosed() OVERRIDE;
     52   virtual views::Widget* GetWidget() OVERRIDE;
     53   virtual const views::Widget* GetWidget() const OVERRIDE;
     54 
     55  private:
     56   // A pointer to the AppModalDialog that owns us.
     57   scoped_ptr<JavaScriptAppModalDialog> parent_;
     58 
     59   // The message box view whose commands we handle.
     60   views::MessageBoxView* message_box_view_;
     61 
     62 #if defined(USE_X11) && !defined(OS_CHROMEOS)
     63   // Blocks events to other browser windows while the dialog is open.
     64   scoped_ptr<JavascriptAppModalEventBlockerX11> event_blocker_x11_;
     65 #endif
     66 
     67   DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialogViews);
     68 };
     69 
     70 #endif  // CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_DIALOG_VIEWS_H_
     71