Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 10388252: Refactoring ExtenionInstallUI to abstract the Browser references. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced + mac fix Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 // Launch app asynchronously so the image will update. 906 // Launch app asynchronously so the image will update.
907 StringValue app_id(extension_id); 907 StringValue app_id(extension_id);
908 web_ui()->CallJavascriptFunction("ntp.launchAppAfterEnable", app_id); 908 web_ui()->CallJavascriptFunction("ntp.launchAppAfterEnable", app_id);
909 return; 909 return;
910 } 910 }
911 911
912 if (!extension_id_prompting_.empty()) 912 if (!extension_id_prompting_.empty())
913 return; // Only one prompt at a time. 913 return; // Only one prompt at a time.
914 914
915 extension_id_prompting_ = extension_id; 915 extension_id_prompting_ = extension_id;
916 GetExtensionInstallUI()->ConfirmReEnable(this, extension); 916 GetExtensionInstallPrompt()->ConfirmReEnable(this, extension);
917 } 917 }
918 918
919 void AppLauncherHandler::ExtensionUninstallAccepted() { 919 void AppLauncherHandler::ExtensionUninstallAccepted() {
920 // Do the uninstall work here. 920 // Do the uninstall work here.
921 DCHECK(!extension_id_prompting_.empty()); 921 DCHECK(!extension_id_prompting_.empty());
922 922
923 // The extension can be uninstalled in another window while the UI was 923 // The extension can be uninstalled in another window while the UI was
924 // showing. Do nothing in that case. 924 // showing. Do nothing in that case.
925 const Extension* extension = 925 const Extension* extension =
926 extension_service_->GetExtensionById(extension_id_prompting_, true); 926 extension_service_->GetExtensionById(extension_id_prompting_, true);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 } 974 }
975 975
976 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { 976 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() {
977 if (!extension_uninstall_dialog_.get()) { 977 if (!extension_uninstall_dialog_.get()) {
978 extension_uninstall_dialog_.reset( 978 extension_uninstall_dialog_.reset(
979 ExtensionUninstallDialog::Create(Profile::FromWebUI(web_ui()), this)); 979 ExtensionUninstallDialog::Create(Profile::FromWebUI(web_ui()), this));
980 } 980 }
981 return extension_uninstall_dialog_.get(); 981 return extension_uninstall_dialog_.get();
982 } 982 }
983 983
984 ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() { 984 ExtensionInstallPrompt* AppLauncherHandler::GetExtensionInstallPrompt() {
985 if (!extension_install_ui_.get()) { 985 if (!extension_install_ui_.get()) {
986 extension_install_ui_.reset( 986 extension_install_ui_.reset(
987 new ExtensionInstallUI(Profile::FromWebUI(web_ui()))); 987 new ExtensionInstallPrompt(Profile::FromWebUI(web_ui())));
988 } 988 }
989 return extension_install_ui_.get(); 989 return extension_install_ui_.get();
990 } 990 }
991 991
992 void AppLauncherHandler::UninstallDefaultApps() { 992 void AppLauncherHandler::UninstallDefaultApps() {
993 AppsPromo* apps_promo = extension_service_->apps_promo(); 993 AppsPromo* apps_promo = extension_service_->apps_promo();
994 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); 994 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps();
995 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); 995 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin();
996 iter != app_ids.end(); ++iter) { 996 iter != app_ids.end(); ++iter) {
997 if (extension_service_->GetExtensionById(*iter, true)) 997 if (extension_service_->GetExtensionById(*iter, true))
998 extension_service_->UninstallExtension(*iter, false, NULL); 998 extension_service_->UninstallExtension(*iter, false, NULL);
999 } 999 }
1000 } 1000 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.h ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698