Chromium Code Reviews| Index: chrome/browser/dom_ui/shown_sections_handler.cc |
| diff --git a/chrome/browser/dom_ui/shown_sections_handler.cc b/chrome/browser/dom_ui/shown_sections_handler.cc |
| index 189c1c3d39b0d4a6c6a995e0d8772a238f0fbf92..3dafffbcfbf802822b84cb9da043f799a8b9fce8 100644 |
| --- a/chrome/browser/dom_ui/shown_sections_handler.cc |
| +++ b/chrome/browser/dom_ui/shown_sections_handler.cc |
| @@ -55,9 +55,6 @@ ShownSectionsHandler::ShownSectionsHandler(PrefService* pref_service) |
| } |
| void ShownSectionsHandler::RegisterMessages() { |
| - notification_registrar_.Add(this, NotificationType::EXTENSION_INSTALLED, |
|
Aaron Boodman
2010/11/11 17:59:13
Looks like this member is no longer used. Can you
Dmitry Polukhin
2010/11/11 20:08:20
Done.
|
| - Source<Profile>(dom_ui_->GetProfile())); |
| - |
| dom_ui_->RegisterMessageCallback("getShownSections", |
| NewCallback(this, &ShownSectionsHandler::HandleGetShownSections)); |
| dom_ui_->RegisterMessageCallback("setShownSections", |
| @@ -73,21 +70,6 @@ void ShownSectionsHandler::Observe(NotificationType type, |
| int sections = pref_service_->GetInteger(prefs::kNTPShownSections); |
| FundamentalValue sections_value(sections); |
| dom_ui_->CallJavascriptFunction(L"setShownSections", sections_value); |
| - } else if (type == NotificationType::EXTENSION_INSTALLED) { |
| - if (Details<const Extension>(details).ptr()->is_app()) { |
| - int mode = pref_service_->GetInteger(prefs::kNTPShownSections); |
| - |
| - // De-minimize the apps section. |
| - mode &= ~MINIMIZED_APPS; |
| - |
| - // Hide any open sections. |
| - mode &= ~ALL_SECTIONS_MASK; |
| - |
| - // Show the apps section. |
| - mode |= APPS; |
| - |
| - pref_service_->SetInteger(prefs::kNTPShownSections, mode); |
| - } |
| } else { |
| NOTREACHED(); |
| } |
| @@ -137,3 +119,22 @@ void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service, |
| if (changed) |
| pref_service->SetInteger(prefs::kNTPShownSections, shown_sections); |
| } |
| + |
| +// static |
| +void ShownSectionsHandler::OnExtensionInstalled(PrefService* prefs, |
| + const Extension* extension) { |
| + if (extension->is_app()) { |
| + int mode = prefs->GetInteger(prefs::kNTPShownSections); |
| + |
| + // De-minimize the apps section. |
| + mode &= ~MINIMIZED_APPS; |
| + |
| + // Hide any open sections. |
| + mode &= ~ALL_SECTIONS_MASK; |
| + |
| + // Show the apps section. |
| + mode |= APPS; |
| + |
| + prefs->SetInteger(prefs::kNTPShownSections, mode); |
| + } |
| +} |