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

Unified Diff: chrome/browser/ui/location_bar/location_bar.cc

Issue 2217643002: Render extension URLs similar to EV certs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pkasting comments Created 4 years 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
Index: chrome/browser/ui/location_bar/location_bar.cc
diff --git a/chrome/browser/ui/location_bar/location_bar.cc b/chrome/browser/ui/location_bar/location_bar.cc
index 81b3724222a22d798cabe369c399b7b0637a03ac..a787b638d00c4282d9a48d651a11aef45e3ca72f 100644
--- a/chrome/browser/ui/location_bar/location_bar.cc
+++ b/chrome/browser/ui/location_bar/location_bar.cc
@@ -4,9 +4,13 @@
#include "chrome/browser/ui/location_bar/location_bar.h"
+#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/manifest_handlers/ui_overrides_handler.h"
+#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_registry.h"
+#include "extensions/common/constants.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/permissions/permissions_data.h"
@@ -32,3 +36,23 @@ bool LocationBar::IsBookmarkStarHiddenByExtension() const {
return false;
}
+
+// static
+base::string16 LocationBar::GetExtensionName(
+ const GURL& url,
+ content::WebContents* web_contents) {
+ CHECK(web_contents);
+ if (!url.SchemeIs(extensions::kExtensionScheme))
+ return base::string16();
+
+ content::BrowserContext* browser_context = web_contents->GetBrowserContext();
+ extensions::ExtensionRegistry* extension_registry =
+ extensions::ExtensionRegistry::Get(browser_context);
+ const extensions::Extension* extension =
+ extension_registry->enabled_extensions().GetByID(url.host());
+ if (extension) {
+ const base::string16 extension_name = base::UTF8ToUTF16(extension->name());
+ return base::CollapseWhitespace(extension_name, false);
+ }
+ return base::string16();
+}
« no previous file with comments | « chrome/browser/ui/location_bar/location_bar.h ('k') | chrome/browser/ui/views/location_bar/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698