summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 22:22:58 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 22:22:58 +0000
commita32a351170c66b3e9e772092311796cc6d539ab1 (patch)
tree5324917fb9361f1098c0cf1fe10df2d3b82ff013 /chrome/browser/ui
parente8ec6a6d1af06ad0a7e5f0dea322887557e51605 (diff)
downloadchromium_src-a32a351170c66b3e9e772092311796cc6d539ab1.zip
chromium_src-a32a351170c66b3e9e772092311796cc6d539ab1.tar.gz
chromium_src-a32a351170c66b3e9e772092311796cc6d539ab1.tar.bz2
ntp4: knock out TODO about not regenerating entire page
when an app page name is renamed (from a different NTP), don't refresh the entire NTP. this also adds a tooltip to the navdots. Also, don't jump the gun by calling javascript functions in response to Notifications if the apps haven't loaded yet. BUG=none TEST=manual Review URL: http://codereview.chromium.org/7862018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.cc25
1 files changed, 7 insertions, 18 deletions
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 8255013..ada3dd9 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -261,7 +261,7 @@ void AppLauncherHandler::RegisterMessages() {
void AppLauncherHandler::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (ignore_changes_)
+ if (ignore_changes_ || !has_loaded_apps_)
return;
switch (type) {
@@ -289,8 +289,7 @@ void AppLauncherHandler::Observe(int type,
break;
highlight_app_id_ = *Details<const std::string>(details).ptr();
- if (has_loaded_apps_)
- SetAppToBeHighlighted();
+ SetAppToBeHighlighted();
break;
}
case chrome::NOTIFICATION_EXTENSION_LOADED: {
@@ -341,23 +340,13 @@ void AppLauncherHandler::Observe(int type,
// The promo may not load until a couple seconds after the first NTP view,
// so we listen for the load notification and notify the NTP when ready.
case chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED:
- if (web_ui_->tab_contents())
- HandleGetApps(NULL);
+ // TODO(estade): try to get rid of this inefficient operation.
+ HandleGetApps(NULL);
break;
case chrome::NOTIFICATION_PREF_CHANGED: {
- if (!web_ui_->tab_contents())
- break;
- // Handle app page renames.
- std::string* pref_name = Details<std::string>(details).ptr();
- if (*pref_name == prefs::kNTPAppPageNames) {
- // TODO(estade): this doesn't need to regenerate the entire page.
- HandleGetApps(NULL);
- } else {
- // Default prefs change handling.
- DictionaryValue dictionary;
- FillAppDictionary(&dictionary);
- web_ui_->CallJavascriptFunction("appsPrefChangeCallback", dictionary);
- }
+ DictionaryValue dictionary;
+ FillAppDictionary(&dictionary);
+ web_ui_->CallJavascriptFunction("appsPrefChangeCallback", dictionary);
break;
}
case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: {