| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "extensions/browser/extension_error.h" | 53 #include "extensions/browser/extension_error.h" |
| 54 #include "extensions/browser/extension_prefs.h" | 54 #include "extensions/browser/extension_prefs.h" |
| 55 #include "extensions/browser/extension_registry.h" | 55 #include "extensions/browser/extension_registry.h" |
| 56 #include "extensions/browser/extension_system.h" | 56 #include "extensions/browser/extension_system.h" |
| 57 #include "extensions/browser/management_policy.h" | 57 #include "extensions/browser/management_policy.h" |
| 58 #include "extensions/browser/view_type_utils.h" | 58 #include "extensions/browser/view_type_utils.h" |
| 59 #include "extensions/common/constants.h" | 59 #include "extensions/common/constants.h" |
| 60 #include "extensions/common/extension_resource.h" | 60 #include "extensions/common/extension_resource.h" |
| 61 #include "extensions/common/extension_set.h" | 61 #include "extensions/common/extension_set.h" |
| 62 #include "extensions/common/install_warning.h" | 62 #include "extensions/common/install_warning.h" |
| 63 #include "extensions/common/manifest.h" |
| 63 #include "extensions/common/manifest_handlers/background_info.h" | 64 #include "extensions/common/manifest_handlers/background_info.h" |
| 64 #include "extensions/common/manifest_handlers/incognito_info.h" | 65 #include "extensions/common/manifest_handlers/incognito_info.h" |
| 65 #include "extensions/common/manifest_handlers/offline_enabled_info.h" | 66 #include "extensions/common/manifest_handlers/offline_enabled_info.h" |
| 66 #include "extensions/common/switches.h" | 67 #include "extensions/common/switches.h" |
| 67 #include "grit/chromium_strings.h" | 68 #include "grit/chromium_strings.h" |
| 68 #include "grit/generated_resources.h" | 69 #include "grit/generated_resources.h" |
| 69 #include "grit/theme_resources.h" | 70 #include "grit/theme_resources.h" |
| 70 #include "net/base/net_util.h" | 71 #include "net/base/net_util.h" |
| 71 #include "ui/base/l10n/l10n_util.h" | 72 #include "ui/base/l10n/l10n_util.h" |
| 72 #include "ui/base/resource/resource_bundle.h" | 73 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 info->type = developer::ITEM_TYPE_THEME; | 355 info->type = developer::ITEM_TYPE_THEME; |
| 355 } else if (item.is_extension()) { | 356 } else if (item.is_extension()) { |
| 356 info->type = developer::ITEM_TYPE_EXTENSION; | 357 info->type = developer::ITEM_TYPE_EXTENSION; |
| 357 } else { | 358 } else { |
| 358 NOTREACHED(); | 359 NOTREACHED(); |
| 359 } | 360 } |
| 360 | 361 |
| 361 if (Manifest::IsUnpackedLocation(item.location())) { | 362 if (Manifest::IsUnpackedLocation(item.location())) { |
| 362 info->path.reset( | 363 info->path.reset( |
| 363 new std::string(base::UTF16ToUTF8(item.path().LossyDisplayName()))); | 364 new std::string(base::UTF16ToUTF8(item.path().LossyDisplayName()))); |
| 364 // If the ErrorConsole is enabled, get the errors for the extension and add | 365 // If the ErrorConsole is enabled and the extension is unpacked, use the |
| 365 // them to the list. Otherwise, use the install warnings (using both is | 366 // more detailed errors from the ErrorConsole. Otherwise, use the install |
| 366 // redundant). | 367 // warnings (using both is redundant). |
| 367 ErrorConsole* error_console = ErrorConsole::Get(GetProfile()); | 368 ErrorConsole* error_console = ErrorConsole::Get(GetProfile()); |
| 368 if (error_console->IsEnabledForAppsDeveloperTools()) { | 369 if (error_console->IsEnabledForAppsDeveloperTools() && |
| 370 item.location() == Manifest::UNPACKED) { |
| 369 const ErrorList& errors = error_console->GetErrorsForExtension(item.id()); | 371 const ErrorList& errors = error_console->GetErrorsForExtension(item.id()); |
| 370 if (!errors.empty()) { | 372 if (!errors.empty()) { |
| 371 for (ErrorList::const_iterator iter = errors.begin(); | 373 for (ErrorList::const_iterator iter = errors.begin(); |
| 372 iter != errors.end(); | 374 iter != errors.end(); |
| 373 ++iter) { | 375 ++iter) { |
| 374 switch ((*iter)->type()) { | 376 switch ((*iter)->type()) { |
| 375 case ExtensionError::MANIFEST_ERROR: | 377 case ExtensionError::MANIFEST_ERROR: |
| 376 info->manifest_errors.push_back( | 378 info->manifest_errors.push_back( |
| 377 make_linked_ptr((*iter)->ToValue().release())); | 379 make_linked_ptr((*iter)->ToValue().release())); |
| 378 break; | 380 break; |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 } | 1354 } |
| 1353 | 1355 |
| 1354 error_ui_util::HandleOpenDevTools(dict); | 1356 error_ui_util::HandleOpenDevTools(dict); |
| 1355 | 1357 |
| 1356 return true; | 1358 return true; |
| 1357 } | 1359 } |
| 1358 | 1360 |
| 1359 } // namespace api | 1361 } // namespace api |
| 1360 | 1362 |
| 1361 } // namespace extensions | 1363 } // namespace extensions |
| OLD | NEW |