| OLD | NEW |
| 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 #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h" | 5 #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 ui::ModalType PlatformVerificationDialog::GetModalType() const { | 122 ui::ModalType PlatformVerificationDialog::GetModalType() const { |
| 123 return ui::MODAL_TYPE_CHILD; | 123 return ui::MODAL_TYPE_CHILD; |
| 124 } | 124 } |
| 125 | 125 |
| 126 gfx::Size PlatformVerificationDialog::GetPreferredSize() const { | 126 gfx::Size PlatformVerificationDialog::GetPreferredSize() const { |
| 127 return gfx::Size(kDialogMaxWidthInPixel, | 127 return gfx::Size(kDialogMaxWidthInPixel, |
| 128 GetHeightForWidth(kDialogMaxWidthInPixel)); | 128 GetHeightForWidth(kDialogMaxWidthInPixel)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void PlatformVerificationDialog::StyledLabelLinkClicked(const gfx::Range& range, | 131 void PlatformVerificationDialog::StyledLabelLinkClicked( |
| 132 int event_flags) { | 132 views::StyledLabel* label, |
| 133 const gfx::Range& range, |
| 134 int event_flags) { |
| 133 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); | 135 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
| 134 const GURL learn_more_url(chrome::kEnhancedPlaybackNotificationLearnMoreURL); | 136 const GURL learn_more_url(chrome::kEnhancedPlaybackNotificationLearnMoreURL); |
| 135 | 137 |
| 136 // |web_contents()| might not be in a browser in case of v2 apps. In that | 138 // |web_contents()| might not be in a browser in case of v2 apps. In that |
| 137 // case, open a new tab in the usual way. | 139 // case, open a new tab in the usual way. |
| 138 if (!browser) { | 140 if (!browser) { |
| 139 Profile* profile = | 141 Profile* profile = |
| 140 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 142 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 141 chrome::NavigateParams params( | 143 chrome::NavigateParams params( |
| 142 profile, learn_more_url, ui::PAGE_TRANSITION_LINK); | 144 profile, learn_more_url, ui::PAGE_TRANSITION_LINK); |
| 143 params.disposition = SINGLETON_TAB; | 145 params.disposition = SINGLETON_TAB; |
| 144 chrome::Navigate(¶ms); | 146 chrome::Navigate(¶ms); |
| 145 } else { | 147 } else { |
| 146 chrome::ShowSingletonTab(browser, learn_more_url); | 148 chrome::ShowSingletonTab(browser, learn_more_url); |
| 147 } | 149 } |
| 148 } | 150 } |
| 149 | 151 |
| 150 void PlatformVerificationDialog::DidStartNavigationToPendingEntry( | 152 void PlatformVerificationDialog::DidStartNavigationToPendingEntry( |
| 151 const GURL& url, | 153 const GURL& url, |
| 152 content::NavigationController::ReloadType reload_type) { | 154 content::NavigationController::ReloadType reload_type) { |
| 153 views::Widget* widget = GetWidget(); | 155 views::Widget* widget = GetWidget(); |
| 154 if (widget) | 156 if (widget) |
| 155 widget->Close(); | 157 widget->Close(); |
| 156 } | 158 } |
| 157 | 159 |
| 158 } // namespace attestation | 160 } // namespace attestation |
| 159 } // namespace chromeos | 161 } // namespace chromeos |
| OLD | NEW |