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

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 7792024: Show app disable and enable on NTP, and desaturate non-offline-enabled apps when offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: u Created 9 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/ui/webui/ntp/app_launcher_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 0355ee7e2ad6279726f037212487ea77ff267862..d9d8bbe571138c54b5ce18a53cd349cde5f8445f 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -116,25 +116,26 @@ void AppLauncherHandler::CreateAppInfo(const Extension* extension,
bool enabled = service->IsExtensionEnabled(extension->id()) &&
!service->GetTerminatedExtension(extension->id());
bool icon_big_exists = true;
+ // Instead of setting grayscale here, we do it in the js.
Evan Stade 2011/08/30 03:34:14 probably best to check for NTP4
Yoyo Zhou 2011/08/30 17:37:10 Done.
GURL icon_big =
ExtensionIconSource::GetIconURL(extension,
Extension::EXTENSION_ICON_LARGE,
ExtensionIconSet::MATCH_EXACTLY,
- !enabled, &icon_big_exists);
+ false, &icon_big_exists);
bool icon_small_exists = true;
GURL icon_small =
ExtensionIconSource::GetIconURL(extension,
Extension::EXTENSION_ICON_BITTY,
ExtensionIconSet::MATCH_BIGGER,
- !enabled, &icon_small_exists);
+ false, &icon_small_exists);
value->Clear();
value->SetString("id", extension->id());
value->SetString("name", extension->name());
value->SetString("description", extension->description());
value->SetString("launch_url", extension->GetFullLaunchURL().spec());
- if (enabled)
- value->SetString("options_url", extension->options_url().spec());
+ value->SetBoolean("enabled", enabled);
+ value->SetString("options_url", extension->options_url().spec());
value->SetBoolean("can_uninstall",
Extension::UserMayDisable(extension->location()));
value->SetString("icon_big", icon_big.spec());
@@ -146,6 +147,7 @@ void AppLauncherHandler::CreateAppInfo(const Extension* extension,
value->SetInteger("launch_type",
prefs->GetLaunchType(extension->id(),
ExtensionPrefs::LAUNCH_DEFAULT));
+ value->SetBoolean("offline_enabled", extension->offline_enabled());
value->SetBoolean("is_component",
extension->location() == Extension::COMPONENT);
value->SetBoolean("is_webstore",
@@ -294,6 +296,9 @@ void AppLauncherHandler::Observe(int type,
case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
const Extension* extension =
Details<UnloadedExtensionInfo>(details)->extension;
+ bool is_uninstall =
Evan Stade 2011/08/30 03:34:14 define this right above first use, not here
Yoyo Zhou 2011/08/30 17:37:10 Done.
+ (Details<UnloadedExtensionInfo>(details)->reason ==
Evan Stade 2011/08/30 03:34:14 don't need ()
Yoyo Zhou 2011/08/30 17:37:10 Gone.
+ extension_misc::UNLOAD_REASON_UNINSTALL);
if (!extension->is_app())
return;
@@ -303,9 +308,12 @@ void AppLauncherHandler::Observe(int type,
}
scoped_ptr<DictionaryValue> app_info(GetAppInfo(extension));
- if (app_info.get())
- web_ui_->CallJavascriptFunction("ntp4.appRemoved", *app_info);
- break;
+ scoped_ptr<BooleanValue> uninstall_value(
+ Value::CreateBooleanValue(is_uninstall));
+ if (app_info.get()) {
+ web_ui_->CallJavascriptFunction(
+ "ntp4.appRemoved", *app_info, *uninstall_value);
+ }
Evan Stade 2011/08/30 03:34:14 no break?
Yoyo Zhou 2011/08/30 17:37:10 Argh, lost it in the merge. Good catch.
}
case chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED:
// The promo may not load until a couple seconds after the first NTP view,
« chrome/browser/resources/ntp4/new_tab.js ('K') | « chrome/browser/resources/ntp4/new_tab.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698