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

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

Issue 9694038: OBSOLETE REVIEW. See http://codereview.chromium.org/10382149/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // The Extension class 'helpfully' wraps bidi control characters that 106 // The Extension class 'helpfully' wraps bidi control characters that
107 // impede our ability to determine directionality. 107 // impede our ability to determine directionality.
108 string16 name = UTF8ToUTF16(extension->name()); 108 string16 name = UTF8ToUTF16(extension->name());
109 base::i18n::UnadjustStringForLocaleDirection(&name); 109 base::i18n::UnadjustStringForLocaleDirection(&name);
110 NewTabUI::SetURLTitleAndDirection(value, name, extension->GetFullLaunchURL()); 110 NewTabUI::SetURLTitleAndDirection(value, name, extension->GetFullLaunchURL());
111 111
112 bool enabled = service->IsExtensionEnabled(extension->id()) && 112 bool enabled = service->IsExtensionEnabled(extension->id()) &&
113 !service->GetTerminatedExtension(extension->id()); 113 !service->GetTerminatedExtension(extension->id());
114 extension->GetBasicInfo(enabled, value); 114 extension->GetBasicInfo(enabled, value);
115 115
116 value->SetBoolean("mayDisable", service->extension_management_policy()->
117 UserMayModifyStatus(extension, NULL));
118
116 bool icon_big_exists = true; 119 bool icon_big_exists = true;
117 // Instead of setting grayscale here, we do it in apps_page.js. 120 // Instead of setting grayscale here, we do it in apps_page.js.
118 GURL icon_big = 121 GURL icon_big =
119 ExtensionIconSource::GetIconURL(extension, 122 ExtensionIconSource::GetIconURL(extension,
120 ExtensionIconSet::EXTENSION_ICON_LARGE, 123 ExtensionIconSet::EXTENSION_ICON_LARGE,
121 ExtensionIconSet::MATCH_BIGGER, 124 ExtensionIconSet::MATCH_BIGGER,
122 false, &icon_big_exists); 125 false, &icon_big_exists);
123 value->SetString("icon_big", icon_big.spec()); 126 value->SetString("icon_big", icon_big.spec());
124 value->SetBoolean("icon_big_exists", icon_big_exists); 127 value->SetBoolean("icon_big_exists", icon_big_exists);
125 bool icon_small_exists = true; 128 bool icon_small_exists = true;
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 598
596 void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { 599 void AppLauncherHandler::HandleUninstallApp(const ListValue* args) {
597 std::string extension_id; 600 std::string extension_id;
598 CHECK(args->GetString(0, &extension_id)); 601 CHECK(args->GetString(0, &extension_id));
599 602
600 const Extension* extension = extension_service_->GetExtensionById( 603 const Extension* extension = extension_service_->GetExtensionById(
601 extension_id, true); 604 extension_id, true);
602 if (!extension) 605 if (!extension)
603 return; 606 return;
604 607
605 if (!Extension::UserMayDisable(extension->location())) { 608 if (!extension_service_->extension_management_policy()->
609 UserMayModifyStatus(extension, NULL)) {
606 LOG(ERROR) << "Attempt to uninstall an extension that is non-usermanagable " 610 LOG(ERROR) << "Attempt to uninstall an extension that is non-usermanagable "
607 << "was made. Extension id : " << extension->id(); 611 << "was made. Extension id : " << extension->id();
608 return; 612 return;
609 } 613 }
610 if (!extension_id_prompting_.empty()) 614 if (!extension_id_prompting_.empty())
611 return; // Only one prompt at a time. 615 return; // Only one prompt at a time.
612 616
613 extension_id_prompting_ = extension_id; 617 extension_id_prompting_ = extension_id;
614 618
615 bool dont_confirm = false; 619 bool dont_confirm = false;
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 986
983 void AppLauncherHandler::UninstallDefaultApps() { 987 void AppLauncherHandler::UninstallDefaultApps() {
984 AppsPromo* apps_promo = extension_service_->apps_promo(); 988 AppsPromo* apps_promo = extension_service_->apps_promo();
985 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); 989 const ExtensionIdSet& app_ids = apps_promo->old_default_apps();
986 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); 990 for (ExtensionIdSet::const_iterator iter = app_ids.begin();
987 iter != app_ids.end(); ++iter) { 991 iter != app_ids.end(); ++iter) {
988 if (extension_service_->GetExtensionById(*iter, true)) 992 if (extension_service_->GetExtensionById(*iter, true))
989 extension_service_->UninstallExtension(*iter, false, NULL); 993 extension_service_->UninstallExtension(*iter, false, NULL);
990 } 994 }
991 } 995 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698