Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / attestation / platform_verification_dialog.h
1 // Copyright 2013 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_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_DIALOG_H_
6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_DIALOG_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/strings/string16.h"
11 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h"
12 #include "ui/views/controls/styled_label_listener.h"
13 #include "ui/views/window/dialog_delegate.h"
14
15 namespace content {
16 class WebContents;
17 }
18
19 namespace chromeos {
20 namespace attestation {
21
22 // A tab-modal dialog UI to ask the user for PlatformVerificationFlow.
23 class PlatformVerificationDialog : public views::DialogDelegateView,
24                                    public views::StyledLabelListener {
25  public:
26   // Initializes a tab-modal dialog for |web_contents| and shows it.
27   static void ShowDialog(
28       content::WebContents* web_contents,
29       const PlatformVerificationFlow::Delegate::ConsentCallback& callback);
30
31  protected:
32   virtual ~PlatformVerificationDialog();
33
34  private:
35   PlatformVerificationDialog(
36       content::WebContents* web_contents,
37       const base::string16& domain,
38       const PlatformVerificationFlow::Delegate::ConsentCallback& callback);
39
40   // Overridden from views::DialogDelegate:
41   virtual bool Cancel() override;
42   virtual bool Accept() override;
43   virtual bool Close() override;
44   virtual base::string16 GetDialogButtonLabel(
45       ui::DialogButton button) const override;
46
47   // Overridden from views::WidgetDelegate:
48   virtual ui::ModalType GetModalType() const override;
49
50   // Overridden from views::View:
51   virtual gfx::Size GetPreferredSize() const override;
52
53   // Overridden from views::StyledLabelListener:
54   virtual void StyledLabelLinkClicked(const gfx::Range& range,
55                                       int event_flags) override;
56
57   content::WebContents* web_contents_;
58   base::string16 domain_;
59   PlatformVerificationFlow::Delegate::ConsentCallback callback_;
60
61   DISALLOW_COPY_AND_ASSIGN(PlatformVerificationDialog);
62 };
63
64 }  // namespace attestation
65 }  // namespace chromeos
66
67 #endif  // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_DIALOG_H_