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

Unified Diff: chrome/browser/ui/webui/options/website_settings_handler.cc

Issue 505073002: Fix a bug where the resource manager displays Chrome Apps with non-human readable names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/ui/webui/options/website_settings_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/ui/webui/options/website_settings_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698