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

Unified Diff: chrome/browser/chromeos/attestation/platform_verification_dialog.cc

Issue 236203017: Fixes the crash for "learn more" link of the dialog for v2 apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/attestation/platform_verification_dialog.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/attestation/platform_verification_dialog.cc
diff --git a/chrome/browser/chromeos/attestation/platform_verification_dialog.cc b/chrome/browser/chromeos/attestation/platform_verification_dialog.cc
index 097b0507b7b473341100734c3f7847178901bcf9..6070d60539f0f290a5613572aead1aaf9e245ca1 100644
--- a/chrome/browser/chromeos/attestation/platform_verification_dialog.cc
+++ b/chrome/browser/chromeos/attestation/platform_verification_dialog.cc
@@ -5,7 +5,9 @@
#include "chrome/browser/chromeos/attestation/platform_verification_dialog.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/common/url_constants.h"
@@ -13,6 +15,7 @@
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/page_transition_types.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "grit/generated_resources.h"
@@ -46,7 +49,7 @@ void PlatformVerificationDialog::ShowDialog(
std::string origin = extension ? extension->name() : url.GetOrigin().spec();
PlatformVerificationDialog* dialog = new PlatformVerificationDialog(
- chrome::FindBrowserWithWebContents(web_contents),
+ web_contents,
base::UTF8ToUTF16(origin),
callback);
@@ -66,10 +69,10 @@ PlatformVerificationDialog::~PlatformVerificationDialog() {
}
PlatformVerificationDialog::PlatformVerificationDialog(
- Browser* browser,
+ content::WebContents* web_contents,
const base::string16& domain,
const PlatformVerificationFlow::Delegate::ConsentCallback& callback)
- : browser_(browser),
+ : web_contents_(web_contents),
domain_(domain),
callback_(callback) {
SetLayoutManager(new views::FillLayout());
@@ -128,8 +131,21 @@ gfx::Size PlatformVerificationDialog::GetPreferredSize() {
void PlatformVerificationDialog::StyledLabelLinkClicked(const gfx::Range& range,
int event_flags) {
- chrome::ShowSingletonTab(browser_, GURL(
- chrome::kEnhancedPlaybackNotificationLearnMoreURL));
+ 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.
+ if (!browser) {
+ Profile* profile = Profile::FromBrowserContext(
+ web_contents_->GetBrowserContext());
+ chrome::NavigateParams params(
+ profile, learn_more_url, content::PAGE_TRANSITION_LINK);
+ params.disposition = SINGLETON_TAB;
+ chrome::Navigate(&params);
+ } else {
+ chrome::ShowSingletonTab(browser, learn_more_url);
+ }
}
} // namespace attestation
« no previous file with comments | « chrome/browser/chromeos/attestation/platform_verification_dialog.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698