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

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

Issue 171483003: Show the extension / app name for platform verification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « no previous file | 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 a45e4e7ffb242dc77b66e5ff5ae14be4692076da..19ffa25876fff85e6a89f66892fa137907f875b7 100644
--- a/chrome/browser/chromeos/attestation/platform_verification_dialog.cc
+++ b/chrome/browser/chromeos/attestation/platform_verification_dialog.cc
@@ -13,6 +13,8 @@
#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 "extensions/browser/extension_registry.h"
+#include "extensions/common/extension.h"
#include "grit/generated_resources.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
@@ -35,7 +37,13 @@ const int kDialogMaxWidthInPixel = 400;
void PlatformVerificationDialog::ShowDialog(
content::WebContents* web_contents,
const PlatformVerificationFlow::Delegate::ConsentCallback& callback) {
- std::string origin = web_contents->GetLastCommittedURL().GetOrigin().spec();
+ GURL url = web_contents->GetLastCommittedURL();
+ // In the case of an extension or hosted app, the origin of the request is
+ // best described by the extension / app name.
+ const extensions::Extension* extension =
+ extensions::ExtensionRegistry::Get(web_contents->GetBrowserContext())->
+ enabled_extensions().GetExtensionOrAppByURL(url);
+ std::string origin = extension ? extension->name() : url.GetOrigin().spec();
PlatformVerificationDialog* dialog = new PlatformVerificationDialog(
chrome::FindBrowserWithWebContents(web_contents),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698