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

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: 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..f2255656ecbe0b502796acf6af9144e5da0cf1ab 100644
--- a/chrome/browser/chromeos/attestation/platform_verification_dialog.cc
+++ b/chrome/browser/chromeos/attestation/platform_verification_dialog.cc
@@ -6,6 +6,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/browser_finder.h"
bartfab (slow) 2014/04/16 12:22:42 Nit: No longer used.
Jun Mukai 2014/04/16 18:00:59 browser_finder is still used in line 132 below
+#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"
@@ -46,7 +47,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 +67,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 +129,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_);
+ GURL learn_more_url(chrome::kEnhancedPlaybackNotificationLearnMoreURL);
bartfab (slow) 2014/04/16 12:22:42 Nit: const.
Jun Mukai 2014/04/16 18:00:59 Done.
+
+ // |web_contents_| might not have a browser in case of v2 apps, in that case
bartfab (slow) 2014/04/16 12:22:42 Nit: s/, in that case/. In that case,/
Jun Mukai 2014/04/16 18:00:59 Done.
+ // open a new tab in a usual way.
bartfab (slow) 2014/04/16 12:22:42 1: Nit: s/ a / the / 2: How do you open a new tab
Jun Mukai 2014/04/16 18:00:59 1: done. 2: as far as I see browser_navigator.cc,
bartfab (slow) 2014/04/16 18:38:59 Thanks for clarifying. I am so used to Chrome OS s
Jun Mukai 2014/04/16 21:23:41 The report is saying a normal v2 app in a normal c
Jun Mukai 2014/04/17 01:33:53 we do not have any plan to provide this in Kiosk a
+ if (!browser) {
+ Profile* profile = Profile::FromBrowserContext(
bartfab (slow) 2014/04/16 12:22:42 Nit: #include "chrome/browser/profiles/profile.h"
Jun Mukai 2014/04/16 18:00:59 Done.
+ web_contents_->GetBrowserContext());
+ chrome::NavigateParams params(
+ profile, learn_more_url, content::PAGE_TRANSITION_LINK);
bartfab (slow) 2014/04/16 12:22:42 Nit: #include "content/public/common/page_transiti
Jun Mukai 2014/04/16 18:00:59 Done.
Jun Mukai 2014/04/16 18:00:59 Done.
+ chrome::Navigate(&params);
+ } else {
+ chrome::ShowSingletonTab(browser, GURL(
bartfab (slow) 2014/04/16 12:22:42 Nit: Use the |learn_more_url| constructed above in
Jun Mukai 2014/04/16 18:00:59 Done.
+ chrome::kEnhancedPlaybackNotificationLearnMoreURL));
+ }
}
} // 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