OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "ui/views/window/dialog_delegate.h" | 11 #include "ui/views/window/dialog_delegate.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace content { | |
15 class WebContents; | |
16 } | |
17 | |
18 namespace views { | 14 namespace views { |
19 class MessageBoxView; | 15 class MessageBoxView; |
20 } | 16 } |
21 | 17 |
22 class ExternalProtocolDialog : public views::DialogDelegate { | 18 class ExternalProtocolDialog : public views::DialogDelegate { |
23 public: | 19 public: |
24 // RunExternalProtocolDialog calls this private constructor. | 20 // RunExternalProtocolDialog calls this private constructor. |
25 ExternalProtocolDialog(content::WebContents* web_contents, | 21 ExternalProtocolDialog(const GURL& url, |
26 const GURL& url, | 22 int render_process_host_id, |
| 23 int routing_id, |
27 const std::wstring& command); | 24 const std::wstring& command); |
28 | 25 |
29 // Returns the path of the application to be launched given the protocol | 26 // Returns the path of the application to be launched given the protocol |
30 // of the requested url. Returns an empty string on failure. | 27 // of the requested url. Returns an empty string on failure. |
31 static std::wstring GetApplicationForProtocol(const GURL& url); | 28 static std::wstring GetApplicationForProtocol(const GURL& url); |
32 | 29 |
33 virtual ~ExternalProtocolDialog(); | 30 virtual ~ExternalProtocolDialog(); |
34 | 31 |
35 // views::DialogDelegate methods: | 32 // views::DialogDelegate methods: |
36 virtual int GetDefaultDialogButton() const OVERRIDE; | 33 virtual int GetDefaultDialogButton() const OVERRIDE; |
37 virtual base::string16 GetDialogButtonLabel( | 34 virtual base::string16 GetDialogButtonLabel( |
38 ui::DialogButton button) const OVERRIDE; | 35 ui::DialogButton button) const OVERRIDE; |
39 virtual base::string16 GetWindowTitle() const OVERRIDE; | 36 virtual base::string16 GetWindowTitle() const OVERRIDE; |
40 virtual void DeleteDelegate() OVERRIDE; | 37 virtual void DeleteDelegate() OVERRIDE; |
41 virtual bool Cancel() OVERRIDE; | 38 virtual bool Cancel() OVERRIDE; |
42 virtual bool Accept() OVERRIDE; | 39 virtual bool Accept() OVERRIDE; |
43 virtual views::View* GetContentsView() OVERRIDE; | 40 virtual views::View* GetContentsView() OVERRIDE; |
44 virtual views::Widget* GetWidget() OVERRIDE; | 41 virtual views::Widget* GetWidget() OVERRIDE; |
45 virtual const views::Widget* GetWidget() const OVERRIDE; | 42 virtual const views::Widget* GetWidget() const OVERRIDE; |
46 | 43 |
47 private: | 44 private: |
48 // The message box view whose commands we handle. | 45 // The message box view whose commands we handle. |
49 views::MessageBoxView* message_box_view_; | 46 views::MessageBoxView* message_box_view_; |
50 | 47 |
51 // The associated WebContents. | |
52 content::WebContents* web_contents_; | |
53 | |
54 // URL of the external protocol request. | 48 // URL of the external protocol request. |
55 GURL url_; | 49 GURL url_; |
56 | 50 |
| 51 // IDs of the associated WebContents. |
| 52 int render_process_host_id_; |
| 53 int routing_id_; |
| 54 |
57 // The time at which this dialog was created. | 55 // The time at which this dialog was created. |
58 base::TimeTicks creation_time_; | 56 base::TimeTicks creation_time_; |
59 | 57 |
60 DISALLOW_COPY_AND_ASSIGN(ExternalProtocolDialog); | 58 DISALLOW_COPY_AND_ASSIGN(ExternalProtocolDialog); |
61 }; | 59 }; |
62 | 60 |
63 #endif // CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_ | 61 #endif // CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_ |
OLD | NEW |