diff options
author | mukai <mukai@chromium.org> | 2014-11-21 17:50:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-22 01:50:40 +0000 |
commit | fa8ed5bdb9f2f5f917a2e2d7adbf3ec9599f675e (patch) | |
tree | abaf631ee1cee9cf10aea244a6e30e0b887e6a20 | |
parent | 1786cee689835689580a72dd7987ef95ef1f0fb6 (diff) | |
download | chromium_src-fa8ed5bdb9f2f5f917a2e2d7adbf3ec9599f675e.zip chromium_src-fa8ed5bdb9f2f5f917a2e2d7adbf3ec9599f675e.tar.gz chromium_src-fa8ed5bdb9f2f5f917a2e2d7adbf3ec9599f675e.tar.bz2 |
Close PlatformVerifiationDialog on reloading the tab.
This CL also includes some style fixes.
BUG=393805
R=dkrahn@chromium.org
TEST=manually
Review URL: https://codereview.chromium.org/747623002
Cr-Commit-Position: refs/heads/master@{#305338}
-rw-r--r-- | chrome/browser/chromeos/attestation/platform_verification_dialog.cc | 20 | ||||
-rw-r--r-- | chrome/browser/chromeos/attestation/platform_verification_dialog.h | 37 |
2 files changed, 35 insertions, 22 deletions
diff --git a/chrome/browser/chromeos/attestation/platform_verification_dialog.cc b/chrome/browser/chromeos/attestation/platform_verification_dialog.cc index b569c562..d3cb6b9 100644 --- a/chrome/browser/chromeos/attestation/platform_verification_dialog.cc +++ b/chrome/browser/chromeos/attestation/platform_verification_dialog.cc @@ -69,7 +69,7 @@ PlatformVerificationDialog::PlatformVerificationDialog( content::WebContents* web_contents, const base::string16& domain, const PlatformVerificationFlow::Delegate::ConsentCallback& callback) - : web_contents_(web_contents), + : content::WebContentsObserver(web_contents), domain_(domain), callback_(callback) { SetLayoutManager(new views::FillLayout()); @@ -128,14 +128,14 @@ gfx::Size PlatformVerificationDialog::GetPreferredSize() const { void PlatformVerificationDialog::StyledLabelLinkClicked(const gfx::Range& range, int event_flags) { - Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); + Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); const GURL learn_more_url(chrome::kEnhancedPlaybackNotificationLearnMoreURL); - // |web_contents_| might not be in a browser in case of v2 apps. In that case, - // open a new tab in the usual way. + // |web_contents()| might not be in a browser in case of v2 apps. In that + // case, open a new tab in the usual way. if (!browser) { - Profile* profile = Profile::FromBrowserContext( - web_contents_->GetBrowserContext()); + Profile* profile = + Profile::FromBrowserContext(web_contents()->GetBrowserContext()); chrome::NavigateParams params( profile, learn_more_url, ui::PAGE_TRANSITION_LINK); params.disposition = SINGLETON_TAB; @@ -145,5 +145,13 @@ void PlatformVerificationDialog::StyledLabelLinkClicked(const gfx::Range& range, } } +void PlatformVerificationDialog::DidStartNavigationToPendingEntry( + const GURL& url, + content::NavigationController::ReloadType reload_type) { + views::Widget* widget = GetWidget(); + if (widget) + widget->Close(); +} + } // namespace attestation } // namespace chromeos diff --git a/chrome/browser/chromeos/attestation/platform_verification_dialog.h b/chrome/browser/chromeos/attestation/platform_verification_dialog.h index 0777cd7..e33ebd0 100644 --- a/chrome/browser/chromeos/attestation/platform_verification_dialog.h +++ b/chrome/browser/chromeos/attestation/platform_verification_dialog.h @@ -9,6 +9,7 @@ #include "base/compiler_specific.h" #include "base/strings/string16.h" #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" +#include "content/public/browser/web_contents_observer.h" #include "ui/views/controls/styled_label_listener.h" #include "ui/views/window/dialog_delegate.h" @@ -21,7 +22,8 @@ namespace attestation { // A tab-modal dialog UI to ask the user for PlatformVerificationFlow. class PlatformVerificationDialog : public views::DialogDelegateView, - public views::StyledLabelListener { + public views::StyledLabelListener, + public content::WebContentsObserver { public: // Initializes a tab-modal dialog for |web_contents| and shows it. static void ShowDialog( @@ -29,7 +31,7 @@ class PlatformVerificationDialog : public views::DialogDelegateView, const PlatformVerificationFlow::Delegate::ConsentCallback& callback); protected: - virtual ~PlatformVerificationDialog(); + ~PlatformVerificationDialog() override; private: PlatformVerificationDialog( @@ -37,24 +39,27 @@ class PlatformVerificationDialog : public views::DialogDelegateView, const base::string16& domain, const PlatformVerificationFlow::Delegate::ConsentCallback& callback); - // Overridden from views::DialogDelegate: - virtual bool Cancel() override; - virtual bool Accept() override; - virtual bool Close() override; - virtual base::string16 GetDialogButtonLabel( - ui::DialogButton button) const override; + // views::DialogDelegate: + bool Cancel() override; + bool Accept() override; + bool Close() override; + base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; - // Overridden from views::WidgetDelegate: - virtual ui::ModalType GetModalType() const override; + // views::WidgetDelegate: + ui::ModalType GetModalType() const override; - // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const override; + // views::View: + gfx::Size GetPreferredSize() const override; - // Overridden from views::StyledLabelListener: - virtual void StyledLabelLinkClicked(const gfx::Range& range, - int event_flags) override; + // views::StyledLabelListener: + void StyledLabelLinkClicked(const gfx::Range& range, + int event_flags) override; + + // content::WebContentsObserver: + void DidStartNavigationToPendingEntry( + const GURL& url, + content::NavigationController::ReloadType reload_type) override; - content::WebContents* web_contents_; base::string16 domain_; PlatformVerificationFlow::Delegate::ConsentCallback callback_; |