Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: chrome/browser/chromeos/attestation/platform_verification_dialog.h

Issue 1001723002: media: Refactor PlatformVerificationFlow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/attestation/platform_verification_dialog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_DIALOG_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_DIALOG_H_
6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_DIALOG_H_ 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_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/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h"
12 #include "content/public/browser/web_contents_observer.h" 11 #include "content/public/browser/web_contents_observer.h"
13 #include "ui/views/controls/styled_label_listener.h" 12 #include "ui/views/controls/styled_label_listener.h"
14 #include "ui/views/window/dialog_delegate.h" 13 #include "ui/views/window/dialog_delegate.h"
15 14
16 namespace content { 15 namespace content {
17 class WebContents; 16 class WebContents;
18 } 17 }
19 18
20 namespace chromeos { 19 namespace chromeos {
21 namespace attestation { 20 namespace attestation {
22 21
23 // A tab-modal dialog UI to ask the user for PlatformVerificationFlow. 22 // A tab-modal dialog UI to ask the user for PlatformVerificationFlow.
24 class PlatformVerificationDialog : public views::DialogDelegateView, 23 class PlatformVerificationDialog : public views::DialogDelegateView,
25 public views::StyledLabelListener, 24 public views::StyledLabelListener,
26 public content::WebContentsObserver { 25 public content::WebContentsObserver {
27 public: 26 public:
27 enum ConsentResponse {
28 CONSENT_RESPONSE_NONE,
29 CONSENT_RESPONSE_ALLOW,
30 CONSENT_RESPONSE_DENY
31 };
32
33 using ConsentCallback = base::Callback<void(ConsentResponse response)>;
34
28 // Initializes a tab-modal dialog for |web_contents| and |requesting_origin| 35 // Initializes a tab-modal dialog for |web_contents| and |requesting_origin|
29 // and shows it. Returns a non-owning pointer to the widget so that caller can 36 // and shows it. Returns a non-owning pointer to the widget so that caller can
30 // close the dialog and cancel the request. The returned widget is only 37 // close the dialog and cancel the request. The returned widget is only
31 // guaranteed to be valid before |callback| is called. 38 // guaranteed to be valid before |callback| is called.
32 static views::Widget* ShowDialog( 39 static views::Widget* ShowDialog(content::WebContents* web_contents,
33 content::WebContents* web_contents, 40 const GURL& requesting_origin,
34 const GURL& requesting_origin, 41 const ConsentCallback& callback);
35 const PlatformVerificationFlow::Delegate::ConsentCallback& callback);
36 42
37 protected: 43 protected:
38 ~PlatformVerificationDialog() override; 44 ~PlatformVerificationDialog() override;
39 45
40 private: 46 private:
41 PlatformVerificationDialog( 47 PlatformVerificationDialog(content::WebContents* web_contents,
42 content::WebContents* web_contents, 48 const base::string16& domain,
43 const base::string16& domain, 49 const ConsentCallback& callback);
44 const PlatformVerificationFlow::Delegate::ConsentCallback& callback);
45 50
46 // views::DialogDelegate: 51 // views::DialogDelegate:
47 bool Cancel() override; 52 bool Cancel() override;
48 bool Accept() override; 53 bool Accept() override;
49 bool Close() override; 54 bool Close() override;
50 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; 55 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
51 56
52 // views::WidgetDelegate: 57 // views::WidgetDelegate:
53 ui::ModalType GetModalType() const override; 58 ui::ModalType GetModalType() const override;
54 59
55 // views::View: 60 // views::View:
56 gfx::Size GetPreferredSize() const override; 61 gfx::Size GetPreferredSize() const override;
57 62
58 // views::StyledLabelListener: 63 // views::StyledLabelListener:
59 void StyledLabelLinkClicked(const gfx::Range& range, 64 void StyledLabelLinkClicked(const gfx::Range& range,
60 int event_flags) override; 65 int event_flags) override;
61 66
62 // content::WebContentsObserver: 67 // content::WebContentsObserver:
63 void DidStartNavigationToPendingEntry( 68 void DidStartNavigationToPendingEntry(
64 const GURL& url, 69 const GURL& url,
65 content::NavigationController::ReloadType reload_type) override; 70 content::NavigationController::ReloadType reload_type) override;
66 71
67 base::string16 domain_; 72 base::string16 domain_;
68 PlatformVerificationFlow::Delegate::ConsentCallback callback_; 73 ConsentCallback callback_;
69 74
70 DISALLOW_COPY_AND_ASSIGN(PlatformVerificationDialog); 75 DISALLOW_COPY_AND_ASSIGN(PlatformVerificationDialog);
71 }; 76 };
72 77
73 } // namespace attestation 78 } // namespace attestation
74 } // namespace chromeos 79 } // namespace chromeos
75 80
76 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_DIALOG_H_ 81 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_DIALOG_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/attestation/platform_verification_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698