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/extensions/api/developer_private/developer_private_api.
h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
6 | 6 |
7 #include "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" |
8 #include "apps/app_restore_service.h" | 8 #include "apps/app_restore_service.h" |
9 #include "apps/app_window.h" | 9 #include "apps/app_window.h" |
10 #include "apps/app_window_registry.h" | 10 #include "apps/app_window_registry.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 namespace { | 89 namespace { |
90 | 90 |
91 const base::FilePath::CharType kUnpackedAppsFolder[] | 91 const base::FilePath::CharType kUnpackedAppsFolder[] |
92 = FILE_PATH_LITERAL("apps_target"); | 92 = FILE_PATH_LITERAL("apps_target"); |
93 | 93 |
94 ExtensionUpdater* GetExtensionUpdater(Profile* profile) { | 94 ExtensionUpdater* GetExtensionUpdater(Profile* profile) { |
95 return profile->GetExtensionService()->updater(); | 95 return profile->GetExtensionService()->updater(); |
96 } | 96 } |
97 | 97 |
98 GURL GetImageURLFromData(std::string contents) { | 98 GURL GetImageURLFromData(const std::string& contents) { |
99 std::string contents_base64; | 99 std::string contents_base64; |
100 base::Base64Encode(contents, &contents_base64); | 100 base::Base64Encode(contents, &contents_base64); |
101 | 101 |
102 // TODO(dvh): make use of content::kDataScheme. Filed as crbug/297301. | 102 // TODO(dvh): make use of content::kDataScheme. Filed as crbug/297301. |
103 const char kDataURLPrefix[] = "data:image;base64,"; | 103 const char kDataURLPrefix[] = "data:image;base64,"; |
104 return GURL(kDataURLPrefix + contents_base64); | 104 return GURL(kDataURLPrefix + contents_base64); |
105 } | 105 } |
106 | 106 |
107 GURL GetDefaultImageURL(developer_private::ItemType type) { | 107 GURL GetDefaultImageURL(developer_private::ItemType type) { |
108 int icon_resource_id; | 108 int icon_resource_id; |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 ExtensionActionAPI::SetBrowserActionVisibility( | 827 ExtensionActionAPI::SetBrowserActionVisibility( |
828 prefs, extension->id(), true); | 828 prefs, extension->id(), true); |
829 } | 829 } |
830 } else { | 830 } else { |
831 service->DisableExtension(extension_id, Extension::DISABLE_USER_ACTION); | 831 service->DisableExtension(extension_id, Extension::DISABLE_USER_ACTION); |
832 } | 832 } |
833 return true; | 833 return true; |
834 } | 834 } |
835 | 835 |
836 void DeveloperPrivateEnableFunction::OnRequirementsChecked( | 836 void DeveloperPrivateEnableFunction::OnRequirementsChecked( |
837 std::string extension_id, | 837 const std::string& extension_id, |
838 std::vector<std::string> requirements_errors) { | 838 std::vector<std::string> requirements_errors) { |
839 if (requirements_errors.empty()) { | 839 if (requirements_errors.empty()) { |
840 ExtensionService* service = GetProfile()->GetExtensionService(); | 840 ExtensionService* service = GetProfile()->GetExtensionService(); |
841 service->EnableExtension(extension_id); | 841 service->EnableExtension(extension_id); |
842 } else { | 842 } else { |
843 ExtensionErrorReporter::GetInstance()->ReportError( | 843 ExtensionErrorReporter::GetInstance()->ReportError( |
844 base::UTF8ToUTF16(JoinString(requirements_errors, ' ')), | 844 base::UTF8ToUTF16(JoinString(requirements_errors, ' ')), |
845 true); // Be noisy. | 845 true); // Be noisy. |
846 } | 846 } |
847 Release(); | 847 Release(); |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 } | 1352 } |
1353 | 1353 |
1354 error_ui_util::HandleOpenDevTools(dict); | 1354 error_ui_util::HandleOpenDevTools(dict); |
1355 | 1355 |
1356 return true; | 1356 return true; |
1357 } | 1357 } |
1358 | 1358 |
1359 } // namespace api | 1359 } // namespace api |
1360 | 1360 |
1361 } // namespace extensions | 1361 } // namespace extensions |
OLD | NEW |