| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "apps/metrics_names.h" | 9 #include "apps/metrics_names.h" |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 highlight_app_id_ = *content::Details<const std::string>(details).ptr(); | 253 highlight_app_id_ = *content::Details<const std::string>(details).ptr(); |
| 254 if (has_loaded_apps_) | 254 if (has_loaded_apps_) |
| 255 SetAppToBeHighlighted(); | 255 SetAppToBeHighlighted(); |
| 256 return; | 256 return; |
| 257 } | 257 } |
| 258 | 258 |
| 259 if (ignore_changes_ || !has_loaded_apps_) | 259 if (ignore_changes_ || !has_loaded_apps_) |
| 260 return; | 260 return; |
| 261 | 261 |
| 262 switch (type) { | 262 switch (type) { |
| 263 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 263 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
| 264 const Extension* extension = | 264 const Extension* extension = |
| 265 content::Details<const Extension>(details).ptr(); | 265 content::Details<const Extension>(details).ptr(); |
| 266 if (!extension->is_app()) | 266 if (!extension->is_app()) |
| 267 return; | 267 return; |
| 268 | 268 |
| 269 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 269 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 270 if (!ShouldDisplayInNewTabPage(extension, prefs)) | 270 if (!ShouldDisplayInNewTabPage(extension, prefs)) |
| 271 return; | 271 return; |
| 272 | 272 |
| 273 scoped_ptr<base::DictionaryValue> app_info(GetAppInfo(extension)); | 273 scoped_ptr<base::DictionaryValue> app_info(GetAppInfo(extension)); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 if (!has_loaded_apps_) { | 466 if (!has_loaded_apps_) { |
| 467 base::Closure callback = base::Bind( | 467 base::Closure callback = base::Bind( |
| 468 &AppLauncherHandler::OnExtensionPreferenceChanged, | 468 &AppLauncherHandler::OnExtensionPreferenceChanged, |
| 469 base::Unretained(this)); | 469 base::Unretained(this)); |
| 470 extension_pref_change_registrar_.Init( | 470 extension_pref_change_registrar_.Init( |
| 471 ExtensionPrefs::Get(profile)->pref_service()); | 471 ExtensionPrefs::Get(profile)->pref_service()); |
| 472 extension_pref_change_registrar_.Add( | 472 extension_pref_change_registrar_.Add( |
| 473 extensions::pref_names::kExtensions, callback); | 473 extensions::pref_names::kExtensions, callback); |
| 474 extension_pref_change_registrar_.Add(prefs::kNtpAppPageNames, callback); | 474 extension_pref_change_registrar_.Add(prefs::kNtpAppPageNames, callback); |
| 475 | 475 |
| 476 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 476 registrar_.Add(this, |
| 477 content::Source<Profile>(profile)); | 477 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 478 content::Source<Profile>(profile)); |
| 478 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 479 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 479 content::Source<Profile>(profile)); | 480 content::Source<Profile>(profile)); |
| 480 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 481 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
| 481 content::Source<Profile>(profile)); | 482 content::Source<Profile>(profile)); |
| 482 registrar_.Add(this, | 483 registrar_.Add(this, |
| 483 chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, | 484 chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, |
| 484 content::Source<AppSorting>( | 485 content::Source<AppSorting>( |
| 485 ExtensionPrefs::Get(profile)->app_sorting())); | 486 ExtensionPrefs::Get(profile)->app_sorting())); |
| 486 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 487 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
| 487 content::Source<CrxInstaller>(NULL)); | 488 content::Source<CrxInstaller>(NULL)); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { | 851 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { |
| 851 if (!extension_uninstall_dialog_.get()) { | 852 if (!extension_uninstall_dialog_.get()) { |
| 852 Browser* browser = chrome::FindBrowserWithWebContents( | 853 Browser* browser = chrome::FindBrowserWithWebContents( |
| 853 web_ui()->GetWebContents()); | 854 web_ui()->GetWebContents()); |
| 854 extension_uninstall_dialog_.reset( | 855 extension_uninstall_dialog_.reset( |
| 855 ExtensionUninstallDialog::Create(extension_service_->profile(), | 856 ExtensionUninstallDialog::Create(extension_service_->profile(), |
| 856 browser, this)); | 857 browser, this)); |
| 857 } | 858 } |
| 858 return extension_uninstall_dialog_.get(); | 859 return extension_uninstall_dialog_.get(); |
| 859 } | 860 } |
| OLD | NEW |