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

Unified Diff: chrome/browser/dom_ui/app_launcher_handler.cc

Issue 3236001: Add the collapsed 'miniview' to the apps and most visisted sections. (Closed)
Patch Set: more unnecessary changes Created 10 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
Index: chrome/browser/dom_ui/app_launcher_handler.cc
diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc
index 825be90933979400a4068fc0458c909fe339ea3d..5c317e9150748ddf38ccfd8b0906a677f2b04016 100644
--- a/chrome/browser/dom_ui/app_launcher_handler.cc
+++ b/chrome/browser/dom_ui/app_launcher_handler.cc
@@ -38,6 +38,21 @@ bool ExtractInt(const ListValue* list, size_t index, int* out_int) {
return false;
}
+std::string GetIconURL(Extension* extension, Extension::Icons icon,
+ const std::string& default_val) {
+ ExtensionResource resource = extension->GetIconPath(icon);
+ if (resource.empty())
+ return default_val;
+
+#if defined(OS_POSIX)
+ std::string path = resource.relative_path().value();
+#elif defined(OS_WIN)
+ std::string path = WideToUTF8(resource.relative_path().value());
+#endif // OS_WIN
+
+ return extension->GetResourceURL(path).spec();
+}
+
} // namespace
AppLauncherHandler::AppLauncherHandler(ExtensionsService* extension_service)
@@ -85,17 +100,13 @@ void AppLauncherHandler::CreateAppInfo(Extension* extension,
value->SetString("launch_url", extension->GetFullLaunchURL().spec());
value->SetString("options_url", extension->options_url().spec());
- FilePath relative_path =
- extension->GetIconPath(Extension::EXTENSION_ICON_LARGE).relative_path();
-
-#if defined(OS_POSIX)
- std::string path = relative_path.value();
-#elif defined(OS_WIN)
- std::string path = WideToUTF8(relative_path.value());
-#endif // OS_WIN
-
- GURL icon_url = extension->GetResourceURL(path);
- value->SetString("icon", icon_url.spec());
+ // TODO(aa): Need a better default icon for apps.
+ value->SetString("icon_big", GetIconURL(
+ extension, Extension::EXTENSION_ICON_LARGE,
+ "chrome://theme/IDR_EXTENSION_DEFAULT_ICON"));
+ value->SetString("icon_small", GetIconURL(
+ extension, Extension::EXTENSION_ICON_BITTY,
+ std::string("chrome://favicon/") + extension->GetFullLaunchURL().spec()));
}
void AppLauncherHandler::HandleGetApps(const ListValue* args) {

Powered by Google App Engine
This is Rietveld 408576698