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

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

Issue 2555063003: Render extension URLs with chips (Closed)
Patch Set: Chip -> text 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..f01caef8c10633019365f6c229dacf5ad86e311d 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,21 @@ 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());
+ return extension ? base::CollapseWhitespace(
+ base::UTF8ToUTF16(extension->name()), false)
+ : 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