Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / external_protocol_dialog.h
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 namespace views {
15 class MessageBoxView;
16 }
17
18 class ExternalProtocolDialog : public views::DialogDelegate {
19  public:
20   // RunExternalProtocolDialog calls this private constructor.
21   ExternalProtocolDialog(const GURL& url,
22                          int render_process_host_id,
23                          int routing_id,
24                          const std::wstring& command);
25
26   // Returns the path of the application to be launched given the protocol
27   // of the requested url. Returns an empty string on failure.
28   static std::wstring GetApplicationForProtocol(const GURL& url);
29
30   virtual ~ExternalProtocolDialog();
31
32   // views::DialogDelegate methods:
33   virtual int GetDefaultDialogButton() const OVERRIDE;
34   virtual base::string16 GetDialogButtonLabel(
35       ui::DialogButton button) const OVERRIDE;
36   virtual base::string16 GetWindowTitle() const OVERRIDE;
37   virtual void DeleteDelegate() OVERRIDE;
38   virtual bool Cancel() OVERRIDE;
39   virtual bool Accept() OVERRIDE;
40   virtual views::View* GetContentsView() OVERRIDE;
41   virtual views::Widget* GetWidget() OVERRIDE;
42   virtual const views::Widget* GetWidget() const OVERRIDE;
43
44  private:
45   // The message box view whose commands we handle.
46   views::MessageBoxView* message_box_view_;
47
48   // URL of the external protocol request.
49   GURL url_;
50
51   // IDs of the associated WebContents.
52   int render_process_host_id_;
53   int routing_id_;
54
55   // The time at which this dialog was created.
56   base::TimeTicks creation_time_;
57
58   DISALLOW_COPY_AND_ASSIGN(ExternalProtocolDialog);
59 };
60
61 #endif  // CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_