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

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

Issue 243463006: Merge 264451 "Fixes the crash for "learn more" link of the dialo..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1916/src/
Patch Set: 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
===================================================================
--- chrome/browser/chromeos/attestation/platform_verification_dialog.cc (revision 265096)
+++ chrome/browser/chromeos/attestation/platform_verification_dialog.cc (working copy)
@@ -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 @@
std::string origin = extension ? extension->name() : url.GetOrigin().spec();
PlatformVerificationDialog* dialog = new PlatformVerificationDialog(
- chrome::FindBrowserWithWebContents(web_contents),
+ web_contents,
base::UTF8ToUTF16(origin),
callback);
@@ -65,10 +68,10 @@
}
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());
@@ -127,8 +130,21 @@
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