| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 // Do the re-enable work here. | 940 // Do the re-enable work here. |
| 941 DCHECK(!extension_id_prompting_.empty()); | 941 DCHECK(!extension_id_prompting_.empty()); |
| 942 | 942 |
| 943 // The extension can be uninstalled in another window while the UI was | 943 // The extension can be uninstalled in another window while the UI was |
| 944 // showing. Do nothing in that case. | 944 // showing. Do nothing in that case. |
| 945 const Extension* extension = | 945 const Extension* extension = |
| 946 extension_service_->GetExtensionById(extension_id_prompting_, true); | 946 extension_service_->GetExtensionById(extension_id_prompting_, true); |
| 947 if (!extension) | 947 if (!extension) |
| 948 return; | 948 return; |
| 949 | 949 |
| 950 extension_service_->GrantPermissionsAndEnableExtension(extension); | 950 extension_service_->GrantPermissionsAndEnableExtension( |
| 951 extension, extension_install_ui_->record_oauth2_grant()); |
| 951 | 952 |
| 952 // We bounce this off the NTP so the browser can update the apps icon. | 953 // We bounce this off the NTP so the browser can update the apps icon. |
| 953 // If we don't launch the app asynchronously, then the app's disabled | 954 // If we don't launch the app asynchronously, then the app's disabled |
| 954 // icon disappears but isn't replaced by the enabled icon, making a poor | 955 // icon disappears but isn't replaced by the enabled icon, making a poor |
| 955 // visual experience. | 956 // visual experience. |
| 956 StringValue app_id(extension->id()); | 957 StringValue app_id(extension->id()); |
| 957 web_ui()->CallJavascriptFunction("ntp.launchAppAfterEnable", app_id); | 958 web_ui()->CallJavascriptFunction("ntp.launchAppAfterEnable", app_id); |
| 958 | 959 |
| 959 extension_id_prompting_ = ""; | 960 extension_id_prompting_ = ""; |
| 960 } | 961 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 | 995 |
| 995 void AppLauncherHandler::UninstallDefaultApps() { | 996 void AppLauncherHandler::UninstallDefaultApps() { |
| 996 AppsPromo* apps_promo = extension_service_->apps_promo(); | 997 AppsPromo* apps_promo = extension_service_->apps_promo(); |
| 997 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 998 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
| 998 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); | 999 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); |
| 999 iter != app_ids.end(); ++iter) { | 1000 iter != app_ids.end(); ++iter) { |
| 1000 if (extension_service_->GetExtensionById(*iter, true)) | 1001 if (extension_service_->GetExtensionById(*iter, true)) |
| 1001 extension_service_->UninstallExtension(*iter, false, NULL); | 1002 extension_service_->UninstallExtension(*iter, false, NULL); |
| 1002 } | 1003 } |
| 1003 } | 1004 } |
| OLD | NEW |