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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // The Extension class 'helpfully' wraps bidi control characters that | 110 // The Extension class 'helpfully' wraps bidi control characters that |
111 // impede our ability to determine directionality. | 111 // impede our ability to determine directionality. |
112 string16 name = UTF8ToUTF16(extension->name()); | 112 string16 name = UTF8ToUTF16(extension->name()); |
113 base::i18n::UnadjustStringForLocaleDirection(&name); | 113 base::i18n::UnadjustStringForLocaleDirection(&name); |
114 NewTabUI::SetURLTitleAndDirection(value, name, extension->GetFullLaunchURL()); | 114 NewTabUI::SetURLTitleAndDirection(value, name, extension->GetFullLaunchURL()); |
115 | 115 |
116 bool enabled = service->IsExtensionEnabled(extension->id()) && | 116 bool enabled = service->IsExtensionEnabled(extension->id()) && |
117 !service->GetTerminatedExtension(extension->id()); | 117 !service->GetTerminatedExtension(extension->id()); |
118 extension->GetBasicInfo(enabled, value); | 118 extension->GetBasicInfo(enabled, value); |
119 | 119 |
120 value->SetBoolean("mayDisable", ExtensionSystem::Get( | 120 value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( |
121 service->profile())->management_policy()->UserMayModifySettings( | 121 service->profile())->management_policy()->UserMayModifySettings( |
122 extension, NULL)); | 122 extension, NULL)); |
123 | 123 |
124 bool icon_big_exists = true; | 124 bool icon_big_exists = true; |
125 // Instead of setting grayscale here, we do it in apps_page.js. | 125 // Instead of setting grayscale here, we do it in apps_page.js. |
126 GURL icon_big = | 126 GURL icon_big = |
127 ExtensionIconSource::GetIconURL(extension, | 127 ExtensionIconSource::GetIconURL(extension, |
128 ExtensionIconSet::EXTENSION_ICON_LARGE, | 128 ExtensionIconSet::EXTENSION_ICON_LARGE, |
129 ExtensionIconSet::MATCH_BIGGER, | 129 ExtensionIconSet::MATCH_BIGGER, |
130 false, &icon_big_exists); | 130 false, &icon_big_exists); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 | 591 |
592 void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { | 592 void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { |
593 std::string extension_id; | 593 std::string extension_id; |
594 CHECK(args->GetString(0, &extension_id)); | 594 CHECK(args->GetString(0, &extension_id)); |
595 | 595 |
596 const Extension* extension = extension_service_->GetExtensionById( | 596 const Extension* extension = extension_service_->GetExtensionById( |
597 extension_id, true); | 597 extension_id, true); |
598 if (!extension) | 598 if (!extension) |
599 return; | 599 return; |
600 | 600 |
601 if (!ExtensionSystem::Get(extension_service_->profile())-> | 601 if (!extensions::ExtensionSystem::Get(extension_service_->profile())-> |
602 management_policy()->UserMayModifySettings(extension, NULL)) { | 602 management_policy()->UserMayModifySettings(extension, NULL)) { |
603 LOG(ERROR) << "Attempt to uninstall an extension that is non-usermanagable " | 603 LOG(ERROR) << "Attempt to uninstall an extension that is non-usermanagable " |
604 << "was made. Extension id : " << extension->id(); | 604 << "was made. Extension id : " << extension->id(); |
605 return; | 605 return; |
606 } | 606 } |
607 if (!extension_id_prompting_.empty()) | 607 if (!extension_id_prompting_.empty()) |
608 return; // Only one prompt at a time. | 608 return; // Only one prompt at a time. |
609 | 609 |
610 extension_id_prompting_ = extension_id; | 610 extension_id_prompting_ = extension_id; |
611 | 611 |
612 bool dont_confirm = false; | 612 bool dont_confirm = false; |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 | 982 |
983 void AppLauncherHandler::UninstallDefaultApps() { | 983 void AppLauncherHandler::UninstallDefaultApps() { |
984 AppsPromo* apps_promo = extension_service_->apps_promo(); | 984 AppsPromo* apps_promo = extension_service_->apps_promo(); |
985 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); | 985 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); |
986 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); | 986 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); |
987 iter != app_ids.end(); ++iter) { | 987 iter != app_ids.end(); ++iter) { |
988 if (extension_service_->GetExtensionById(*iter, true)) | 988 if (extension_service_->GetExtensionById(*iter, true)) |
989 extension_service_->UninstallExtension(*iter, false, NULL); | 989 extension_service_->UninstallExtension(*iter, false, NULL); |
990 } | 990 } |
991 } | 991 } |
OLD | NEW |