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..0431554b5b0101b1a2104b5b4c2dc5bb4fee17ab 100644 |
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
@@ -269,6 +269,17 @@ void AppLauncherHandler::Observe(int type, |
web_ui_->CallJavascriptFunction("appNotificationChanged", args); |
break; |
} |
+ case chrome::NOTIFICATION_APP_INSTALLED_TO_NTP: { |
+ const std::string* extension_id = |
+ Details<const std::string>(details).ptr(); |
+ |
+ if (!NewTabUI::NTP4Enabled()) |
+ break; |
+ |
+ scoped_ptr<StringValue> app_id(Value::CreateStringValue(*extension_id)); |
+ web_ui_->CallJavascriptFunction("ntp4.setAppToBeHighlighted", *app_id); |
+ break; |
+ } |
case chrome::NOTIFICATION_EXTENSION_LOADED: { |
const Extension* extension = Details<const Extension>(details).ptr(); |
if (!extension->is_app()) |
@@ -471,6 +482,8 @@ void AppLauncherHandler::HandleGetApps(const ListValue* args) { |
if (registrar_.IsEmpty()) { |
registrar_.Add(this, chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, |
NotificationService::AllSources()); |
+ registrar_.Add(this, chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, |
+ Source<TabContents>(web_ui_->tab_contents())); |
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
NotificationService::AllSources()); |
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
@@ -865,7 +878,7 @@ void AppLauncherHandler::PromptToEnableApp(const std::string& extension_id) { |
extension_service_->EnableExtension(extension_id); |
// Launch app asynchronously so the image will update. |
- StringValue* app_id = Value::CreateStringValue(extension_id); |
+ scoped_ptr<StringValue> app_id(Value::CreateStringValue(extension_id)); |
web_ui_->CallJavascriptFunction("launchAppAfterEnable", *app_id); |
return; |
} |
@@ -915,7 +928,7 @@ void AppLauncherHandler::InstallUIProceed() { |
// If we don't launch the app asynchronously, then the app's disabled |
// icon disappears but isn't replaced by the enabled icon, making a poor |
// visual experience. |
- StringValue* app_id = Value::CreateStringValue(extension->id()); |
+ scoped_ptr<StringValue> app_id(Value::CreateStringValue(extension->id())); |
web_ui_->CallJavascriptFunction("launchAppAfterEnable", *app_id); |
extension_id_prompting_ = ""; |