• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_EXTERNAL_PROTOCOL_DIALOG_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_
7 #pragma once
8 
9 #include "base/time.h"
10 #include "googleurl/src/gurl.h"
11 #include "views/window/dialog_delegate.h"
12 
13 class TabContents;
14 
15 namespace views {
16 class MessageBoxView;
17 }
18 
19 class ExternalProtocolDialog : public views::DialogDelegate {
20  public:
21   // RunExternalProtocolDialog calls this private constructor.
22   ExternalProtocolDialog(TabContents* tab_contents,
23                          const GURL& url,
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;
34   virtual std::wstring GetDialogButtonLabel(
35       MessageBoxFlags::DialogButton button) const;
36   virtual std::wstring GetWindowTitle() const;
37   virtual void DeleteDelegate();
38   virtual bool Cancel();
39   virtual bool Accept();
40   virtual views::View* GetContentsView();
41 
42   // views::WindowDelegate Methods:
IsAlwaysOnTop()43   virtual bool IsAlwaysOnTop() const { return false; }
IsModal()44   virtual bool IsModal() const { return false; }
45 
46  private:
47   // The message box view whose commands we handle.
48   views::MessageBoxView* message_box_view_;
49 
50   // The associated TabContents.
51   TabContents* tab_contents_;
52 
53   // URL of the external protocol request.
54   GURL url_;
55 
56   // The time at which this dialog was created.
57   base::TimeTicks creation_time_;
58 
59   DISALLOW_COPY_AND_ASSIGN(ExternalProtocolDialog);
60 };
61 
62 #endif  // CHROME_BROWSER_UI_VIEWS_EXTERNAL_PROTOCOL_DIALOG_H_
63