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

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

Issue 7776001: ntp4: improved app install, try 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix trash change 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..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_ = "";

Powered by Google App Engine
This is Rietveld 408576698