OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/app_launcher_handler.h" | 5 #include "chrome/browser/dom_ui/app_launcher_handler.h" |
6 | 6 |
7 #include "app/animation.h" | 7 #include "app/animation.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 if (list->GetString(index, &string_value)) { | 34 if (list->GetString(index, &string_value)) { |
35 base::StringToInt(string_value, out_int); | 35 base::StringToInt(string_value, out_int); |
36 return true; | 36 return true; |
37 } | 37 } |
38 | 38 |
39 return false; | 39 return false; |
40 } | 40 } |
41 | 41 |
42 std::string GetIconURL(Extension* extension, Extension::Icons icon, | 42 std::string GetIconURL(Extension* extension, Extension::Icons icon, |
43 const std::string& default_val) { | 43 const std::string& default_val) { |
44 ExtensionResource resource = extension->GetIconPath(icon); | 44 GURL url = extension->GetIconURL(icon); |
45 if (resource.empty()) | 45 if (!url.is_empty()) |
| 46 return url.spec(); |
| 47 else |
46 return default_val; | 48 return default_val; |
47 | |
48 #if defined(OS_POSIX) | |
49 std::string path = resource.relative_path().value(); | |
50 #elif defined(OS_WIN) | |
51 std::string path = WideToUTF8(resource.relative_path().value()); | |
52 #endif // OS_WIN | |
53 | |
54 return extension->GetResourceURL(path).spec(); | |
55 } | 49 } |
56 | 50 |
57 } // namespace | 51 } // namespace |
58 | 52 |
59 AppLauncherHandler::AppLauncherHandler(ExtensionsService* extension_service) | 53 AppLauncherHandler::AppLauncherHandler(ExtensionsService* extension_service) |
60 : extensions_service_(extension_service) { | 54 : extensions_service_(extension_service) { |
61 } | 55 } |
62 | 56 |
63 AppLauncherHandler::~AppLauncherHandler() {} | 57 AppLauncherHandler::~AppLauncherHandler() {} |
64 | 58 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { | 212 void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { |
219 std::string extension_id = WideToUTF8(ExtractStringValue(args)); | 213 std::string extension_id = WideToUTF8(ExtractStringValue(args)); |
220 | 214 |
221 // Make sure that the extension exists. | 215 // Make sure that the extension exists. |
222 Extension* extension = | 216 Extension* extension = |
223 extensions_service_->GetExtensionById(extension_id, false); | 217 extensions_service_->GetExtensionById(extension_id, false); |
224 DCHECK(extension); | 218 DCHECK(extension); |
225 | 219 |
226 extensions_service_->UninstallExtension(extension_id, false); | 220 extensions_service_->UninstallExtension(extension_id, false); |
227 } | 221 } |
OLD | NEW |