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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // The Extension class 'helpfully' wraps bidi control characters that | 109 // The Extension class 'helpfully' wraps bidi control characters that |
110 // impede our ability to determine directionality. | 110 // impede our ability to determine directionality. |
111 string16 name = UTF8ToUTF16(extension->name()); | 111 string16 name = UTF8ToUTF16(extension->name()); |
112 base::i18n::UnadjustStringForLocaleDirection(&name); | 112 base::i18n::UnadjustStringForLocaleDirection(&name); |
113 NewTabUI::SetURLTitleAndDirection(value, name, extension->GetFullLaunchURL()); | 113 NewTabUI::SetURLTitleAndDirection(value, name, extension->GetFullLaunchURL()); |
114 | 114 |
115 bool enabled = service->IsExtensionEnabled(extension->id()) && | 115 bool enabled = service->IsExtensionEnabled(extension->id()) && |
116 !service->GetTerminatedExtension(extension->id()); | 116 !service->GetTerminatedExtension(extension->id()); |
117 extension->GetBasicInfo(enabled, value); | 117 extension->GetBasicInfo(enabled, value); |
118 | 118 |
119 value->SetBoolean("mayDisable", ExtensionSystem::Get( | 119 value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( |
120 service->profile())->management_policy()->UserMayModifySettings( | 120 service->profile())->management_policy()->UserMayModifySettings( |
121 extension, NULL)); | 121 extension, NULL)); |
122 | 122 |
123 bool icon_big_exists = true; | 123 bool icon_big_exists = true; |
124 // Instead of setting grayscale here, we do it in apps_page.js. | 124 // Instead of setting grayscale here, we do it in apps_page.js. |
125 GURL icon_big = | 125 GURL icon_big = |
126 ExtensionIconSource::GetIconURL(extension, | 126 ExtensionIconSource::GetIconURL(extension, |
127 ExtensionIconSet::EXTENSION_ICON_LARGE, | 127 ExtensionIconSet::EXTENSION_ICON_LARGE, |
128 ExtensionIconSet::MATCH_BIGGER, | 128 ExtensionIconSet::MATCH_BIGGER, |
129 false, &icon_big_exists); | 129 false, &icon_big_exists); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 | 606 |
607 void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { | 607 void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { |
608 std::string extension_id; | 608 std::string extension_id; |
609 CHECK(args->GetString(0, &extension_id)); | 609 CHECK(args->GetString(0, &extension_id)); |
610 | 610 |
611 const Extension* extension = extension_service_->GetExtensionById( | 611 const Extension* extension = extension_service_->GetExtensionById( |
612 extension_id, true); | 612 extension_id, true); |
613 if (!extension) | 613 if (!extension) |
614 return; | 614 return; |
615 | 615 |
616 if (!ExtensionSystem::Get(extension_service_->profile())-> | 616 if (!extensions::ExtensionSystem::Get(extension_service_->profile())-> |
617 management_policy()->UserMayModifySettings(extension, NULL)) { | 617 management_policy()->UserMayModifySettings(extension, NULL)) { |
618 LOG(ERROR) << "Attempt to uninstall an extension that is non-usermanagable " | 618 LOG(ERROR) << "Attempt to uninstall an extension that is non-usermanagable " |
619 << "was made. Extension id : " << extension->id(); | 619 << "was made. Extension id : " << extension->id(); |
620 return; | 620 return; |
621 } | 621 } |
622 if (!extension_id_prompting_.empty()) | 622 if (!extension_id_prompting_.empty()) |
623 return; // Only one prompt at a time. | 623 return; // Only one prompt at a time. |
624 | 624 |
625 extension_id_prompting_ = extension_id; | 625 extension_id_prompting_ = extension_id; |
626 | 626 |
627 bool dont_confirm = false; | 627 bool dont_confirm = false; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 | 996 |
997 void AppLauncherHandler::UninstallDefaultApps() { | 997 void AppLauncherHandler::UninstallDefaultApps() { |
998 AppsPromo* apps_promo = extension_service_->apps_promo(); | 998 AppsPromo* apps_promo = extension_service_->apps_promo(); |
999 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 999 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
1000 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); | 1000 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); |
1001 iter != app_ids.end(); ++iter) { | 1001 iter != app_ids.end(); ++iter) { |
1002 if (extension_service_->GetExtensionById(*iter, true)) | 1002 if (extension_service_->GetExtensionById(*iter, true)) |
1003 extension_service_->UninstallExtension(*iter, false, NULL); | 1003 extension_service_->UninstallExtension(*iter, false, NULL); |
1004 } | 1004 } |
1005 } | 1005 } |
OLD | NEW |