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_JS_MODAL_DIALOG_VIEWS_H_ 6 #define CHROME_BROWSER_UI_VIEWS_JS_MODAL_DIALOG_VIEWS_H_ 7 #pragma once 8 9 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" 10 11 #include <string> 12 13 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" 14 #include "ui/base/message_box_flags.h" 15 #include "views/window/dialog_delegate.h" 16 17 namespace views { 18 class MessageBoxView; 19 } 20 21 class JSModalDialogViews : public NativeAppModalDialog, 22 public views::DialogDelegate { 23 public: 24 explicit JSModalDialogViews(JavaScriptAppModalDialog* parent); 25 virtual ~JSModalDialogViews(); 26 27 // Overridden from NativeAppModalDialog: 28 virtual int GetAppModalDialogButtons() const; 29 virtual void ShowAppModalDialog(); 30 virtual void ActivateAppModalDialog(); 31 virtual void CloseAppModalDialog(); 32 virtual void AcceptAppModalDialog(); 33 virtual void CancelAppModalDialog(); 34 35 // Overridden from views::DialogDelegate: 36 virtual int GetDefaultDialogButton() const; 37 virtual int GetDialogButtons() const; 38 virtual std::wstring GetWindowTitle() const; 39 virtual void WindowClosing(); 40 virtual void DeleteDelegate(); 41 virtual bool Cancel(); 42 virtual bool Accept(); 43 virtual std::wstring GetDialogButtonLabel( 44 ui::MessageBoxFlags::DialogButton button) const; 45 46 // Overridden from views::WindowDelegate: 47 virtual bool IsModal() const; 48 virtual views::View* GetContentsView(); 49 virtual views::View* GetInitiallyFocusedView(); 50 virtual void OnClose(); 51 52 private: 53 // A pointer to the AppModalDialog that owns us. 54 JavaScriptAppModalDialog* parent_; 55 56 // The message box view whose commands we handle. 57 views::MessageBoxView* message_box_view_; 58 59 DISALLOW_COPY_AND_ASSIGN(JSModalDialogViews); 60 }; 61 62 #endif // CHROME_BROWSER_UI_VIEWS_JS_MODAL_DIALOG_VIEWS_H_ 63