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/extensions/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 ++iter) { | 185 ++iter) { |
186 string16 warning_string( | 186 string16 warning_string( |
187 ExtensionWarningSet::GetLocalizedWarning(*iter)); | 187 ExtensionWarningSet::GetLocalizedWarning(*iter)); |
188 warnings_list->Append(Value::CreateStringValue(warning_string)); | 188 warnings_list->Append(Value::CreateStringValue(warning_string)); |
189 } | 189 } |
190 extension_data->Set("warnings", warnings_list); | 190 extension_data->Set("warnings", warnings_list); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 // Add install warnings (these are not the same as warnings!). | 194 // Add install warnings (these are not the same as warnings!). |
195 const Extension::InstallWarningVector& install_warnings = | 195 if (extension->location() == Extension::LOAD) { |
196 extension->install_warnings(); | 196 const Extension::InstallWarningVector& install_warnings = |
197 if (!install_warnings.empty()) { | 197 extension->install_warnings(); |
198 scoped_ptr<ListValue> list(new ListValue()); | 198 if (!install_warnings.empty()) { |
199 for (Extension::InstallWarningVector::const_iterator it = | 199 scoped_ptr<ListValue> list(new ListValue()); |
200 install_warnings.begin(); it != install_warnings.end(); ++it) { | 200 for (Extension::InstallWarningVector::const_iterator it = |
201 DictionaryValue* item = new DictionaryValue(); | 201 install_warnings.begin(); it != install_warnings.end(); ++it) { |
202 item->SetBoolean("isHTML", | 202 DictionaryValue* item = new DictionaryValue(); |
203 it->format == Extension::InstallWarning::FORMAT_HTML); | 203 item->SetBoolean("isHTML", |
204 item->SetString("message", it->message); | 204 it->format == Extension::InstallWarning::FORMAT_HTML); |
205 list->Append(item); | 205 item->SetString("message", it->message); |
| 206 list->Append(item); |
| 207 } |
| 208 extension_data->Set("installWarnings", list.release()); |
206 } | 209 } |
207 extension_data->Set("installWarnings", list.release()); | |
208 } | 210 } |
209 | 211 |
210 return extension_data; | 212 return extension_data; |
211 } | 213 } |
212 | 214 |
213 void ExtensionSettingsHandler::GetLocalizedValues( | 215 void ExtensionSettingsHandler::GetLocalizedValues( |
214 DictionaryValue* localized_strings) { | 216 DictionaryValue* localized_strings) { |
215 localized_strings->SetString("extensionSettings", | 217 localized_strings->SetString("extensionSettings", |
216 l10n_util::GetStringUTF16(IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE)); | 218 l10n_util::GetStringUTF16(IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE)); |
217 | 219 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 return extension_uninstall_dialog_.get(); | 876 return extension_uninstall_dialog_.get(); |
875 #else | 877 #else |
876 return NULL; | 878 return NULL; |
877 #endif // !defined(OS_ANDROID) | 879 #endif // !defined(OS_ANDROID) |
878 } | 880 } |
879 | 881 |
880 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { | 882 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { |
881 if (host) | 883 if (host) |
882 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); | 884 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); |
883 } | 885 } |
OLD | NEW |