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_EXTERNAL_PROTOCOL_DIALOG_H_ 6 #define CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_ 7 8 #include "base/basictypes.h" 9 #include "base/compiler_specific.h" 10 #include "base/time/time.h" 11 #include "ui/views/window/dialog_delegate.h" 12 #include "url/gurl.h" 13 14 class ProtocolDialogDelegate; 15 16 namespace views { 17 class MessageBoxView; 18 } 19 20 class ExternalProtocolDialog : public views::DialogDelegate { 21 public: 22 // RunExternalProtocolDialog calls this private constructor. 23 ExternalProtocolDialog(scoped_ptr<const ProtocolDialogDelegate> delegate, 24 int render_process_host_id, 25 int routing_id); 26 27 virtual ~ExternalProtocolDialog(); 28 29 // views::DialogDelegate methods: 30 virtual int GetDefaultDialogButton() const OVERRIDE; 31 virtual base::string16 GetDialogButtonLabel( 32 ui::DialogButton button) const OVERRIDE; 33 virtual base::string16 GetWindowTitle() const OVERRIDE; 34 virtual void DeleteDelegate() OVERRIDE; 35 virtual bool Cancel() OVERRIDE; 36 virtual bool Accept() OVERRIDE; 37 virtual views::View* GetContentsView() OVERRIDE; 38 virtual views::Widget* GetWidget() OVERRIDE; 39 virtual const views::Widget* GetWidget() const OVERRIDE; 40 41 private: 42 const scoped_ptr<const ProtocolDialogDelegate> delegate_; 43 44 // The message box view whose commands we handle. 45 views::MessageBoxView* message_box_view_; 46 47 // IDs of the associated WebContents. 48 int render_process_host_id_; 49 int routing_id_; 50 51 // The time at which this dialog was created. 52 base::TimeTicks creation_time_; 53 54 DISALLOW_COPY_AND_ASSIGN(ExternalProtocolDialog); 55 }; 56 57 #endif // CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_ 58