| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 base::Value::CreateBooleanValue( | 277 base::Value::CreateBooleanValue( |
| 278 prefs->IsFromBookmark(extension->id()) && | 278 prefs->IsFromBookmark(extension->id()) && |
| 279 attempted_bookmark_app_install_)); | 279 attempted_bookmark_app_install_)); |
| 280 attempted_bookmark_app_install_ = false; | 280 attempted_bookmark_app_install_ = false; |
| 281 web_ui()->CallJavascriptFunction( | 281 web_ui()->CallJavascriptFunction( |
| 282 "ntp.appAdded", *app_info, *highlight); | 282 "ntp.appAdded", *app_info, *highlight); |
| 283 } | 283 } |
| 284 | 284 |
| 285 break; | 285 break; |
| 286 } | 286 } |
| 287 case chrome::NOTIFICATION_EXTENSION_UNLOADED: | 287 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
| 288 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { | 288 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { |
| 289 const Extension* extension = NULL; | 289 const Extension* extension = NULL; |
| 290 bool uninstalled = false; | 290 bool uninstalled = false; |
| 291 if (type == chrome::NOTIFICATION_EXTENSION_UNINSTALLED) { | 291 if (type == chrome::NOTIFICATION_EXTENSION_UNINSTALLED) { |
| 292 extension = content::Details<const Extension>(details).ptr(); | 292 extension = content::Details<const Extension>(details).ptr(); |
| 293 uninstalled = true; | 293 uninstalled = true; |
| 294 } else { // NOTIFICATION_EXTENSION_UNLOADED | 294 } else { // NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED |
| 295 if (content::Details<UnloadedExtensionInfo>(details)->reason == | 295 if (content::Details<UnloadedExtensionInfo>(details)->reason == |
| 296 UnloadedExtensionInfo::REASON_UNINSTALL) { | 296 UnloadedExtensionInfo::REASON_UNINSTALL) { |
| 297 // Uninstalls are tracked by NOTIFICATION_EXTENSION_UNINSTALLED. | 297 // Uninstalls are tracked by NOTIFICATION_EXTENSION_UNINSTALLED. |
| 298 return; | 298 return; |
| 299 } | 299 } |
| 300 extension = content::Details<extensions::UnloadedExtensionInfo>( | 300 extension = content::Details<extensions::UnloadedExtensionInfo>( |
| 301 details)->extension; | 301 details)->extension; |
| 302 uninstalled = false; | 302 uninstalled = false; |
| 303 } | 303 } |
| 304 if (!extension->is_app()) | 304 if (!extension->is_app()) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 &AppLauncherHandler::OnExtensionPreferenceChanged, | 465 &AppLauncherHandler::OnExtensionPreferenceChanged, |
| 466 base::Unretained(this)); | 466 base::Unretained(this)); |
| 467 extension_pref_change_registrar_.Init( | 467 extension_pref_change_registrar_.Init( |
| 468 ExtensionPrefs::Get(profile)->pref_service()); | 468 ExtensionPrefs::Get(profile)->pref_service()); |
| 469 extension_pref_change_registrar_.Add( | 469 extension_pref_change_registrar_.Add( |
| 470 extensions::pref_names::kExtensions, callback); | 470 extensions::pref_names::kExtensions, callback); |
| 471 extension_pref_change_registrar_.Add(prefs::kNtpAppPageNames, callback); | 471 extension_pref_change_registrar_.Add(prefs::kNtpAppPageNames, callback); |
| 472 | 472 |
| 473 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 473 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 474 content::Source<Profile>(profile)); | 474 content::Source<Profile>(profile)); |
| 475 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 475 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 476 content::Source<Profile>(profile)); | 476 content::Source<Profile>(profile)); |
| 477 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 477 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
| 478 content::Source<Profile>(profile)); | 478 content::Source<Profile>(profile)); |
| 479 registrar_.Add(this, | 479 registrar_.Add(this, |
| 480 chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, | 480 chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, |
| 481 content::Source<AppSorting>( | 481 content::Source<AppSorting>( |
| 482 ExtensionPrefs::Get(profile)->app_sorting())); | 482 ExtensionPrefs::Get(profile)->app_sorting())); |
| 483 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 483 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
| 484 content::Source<CrxInstaller>(NULL)); | 484 content::Source<CrxInstaller>(NULL)); |
| 485 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, | 485 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { | 848 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { |
| 849 if (!extension_uninstall_dialog_.get()) { | 849 if (!extension_uninstall_dialog_.get()) { |
| 850 Browser* browser = chrome::FindBrowserWithWebContents( | 850 Browser* browser = chrome::FindBrowserWithWebContents( |
| 851 web_ui()->GetWebContents()); | 851 web_ui()->GetWebContents()); |
| 852 extension_uninstall_dialog_.reset( | 852 extension_uninstall_dialog_.reset( |
| 853 ExtensionUninstallDialog::Create(extension_service_->profile(), | 853 ExtensionUninstallDialog::Create(extension_service_->profile(), |
| 854 browser, this)); | 854 browser, this)); |
| 855 } | 855 } |
| 856 return extension_uninstall_dialog_.get(); | 856 return extension_uninstall_dialog_.get(); |
| 857 } | 857 } |
| OLD | NEW |