Index: chrome/browser/ui/webui/options/website_settings_handler.cc |
diff --git a/chrome/browser/ui/webui/options/website_settings_handler.cc b/chrome/browser/ui/webui/options/website_settings_handler.cc |
index 8999398729c5b6544fce9b9304da7b763dc23797..b7325ad42a1aca71b0b3ca5bf8b802cacb2263f5 100644 |
--- a/chrome/browser/ui/webui/options/website_settings_handler.cc |
+++ b/chrome/browser/ui/webui/options/website_settings_handler.cc |
@@ -7,6 +7,7 @@ |
#include "apps/app_window_registry.h" |
#include "chrome/browser/content_settings/content_settings_utils.h" |
#include "chrome/browser/content_settings/host_content_settings_map.h" |
+#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_iterator.h" |
@@ -16,6 +17,7 @@ |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_ui.h" |
#include "extensions/browser/extension_registry.h" |
+#include "extensions/browser/extension_system.h" |
#include "extensions/common/constants.h" |
#include "extensions/common/extension.h" |
#include "grit/generated_resources.h" |
@@ -261,6 +263,8 @@ void WebsiteSettingsHandler::UpdateOrigins() { |
base::Time::Now() - last_usage); |
} |
origin_entry->SetStringWithoutPathExpansion("usageString", usage_string); |
+ origin_entry->SetStringWithoutPathExpansion("readableName", |
+ GetReadableName(origin_url)); |
origins.SetWithoutPathExpansion(origin, origin_entry); |
} |
@@ -451,6 +455,8 @@ void WebsiteSettingsHandler::UpdateLocalStorage() { |
"usage", new base::FundamentalValue(static_cast<double>(it->size))); |
origin_entry->SetWithoutPathExpansion( |
"usageString", new base::StringValue(ui::FormatBytes(it->size))); |
+ origin_entry->SetStringWithoutPathExpansion( |
+ "readableName", GetReadableName(it->origin_url)); |
local_storage_map.SetWithoutPathExpansion(origin, origin_entry); |
} |
web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins", |
@@ -505,4 +511,23 @@ void WebsiteSettingsHandler::DeleteLocalStorage(const GURL& site_url) { |
weak_ptr_factory_.GetWeakPtr())); |
} |
+const std::string& WebsiteSettingsHandler::GetReadableName( |
+ const GURL& site_url) { |
+ if (site_url.SchemeIs(extensions::kExtensionScheme)) { |
+ Profile* profile = Profile::FromWebUI(web_ui()); |
+ ExtensionService* extension_service = |
+ extensions::ExtensionSystem::Get(profile)->extension_service(); |
+ if (!extension_service) |
Bernhard Bauer
2014/08/26 07:44:31
When is this NULL?
Daniel Nishi
2014/08/26 17:22:33
Hmm. Looking at it, it looks like this situation s
|
+ return site_url.spec(); |
+ |
+ const extensions::Extension* extension = |
+ extension_service->extensions()->GetExtensionOrAppByURL(site_url); |
+ if (!extension) |
Bernhard Bauer
2014/08/26 07:44:31
And this?
Daniel Nishi
2014/08/26 17:22:33
This is NULL if for some reason an chrome-extensio
Bernhard Bauer
2014/08/26 17:25:58
Makes sense. Can you add a comment that explains t
Daniel Nishi
2014/08/26 17:48:54
Done.
|
+ return site_url.spec(); |
+ |
+ return extension->name(); |
+ } |
+ return site_url.spec(); |
+} |
+ |
} // namespace options |