| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_loader_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_loader_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 installer->set_be_noisy_on_failure(false); | 226 installer->set_be_noisy_on_failure(false); |
| 227 | 227 |
| 228 installer->Load(file_path); | 228 installer->Load(file_path); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void ExtensionLoaderHandler::OnLoadFailure(const base::FilePath& file_path, | 231 void ExtensionLoaderHandler::OnLoadFailure(const base::FilePath& file_path, |
| 232 const std::string& error) { | 232 const std::string& error) { |
| 233 size_t line = 0u; | 233 size_t line = 0u; |
| 234 size_t column = 0u; | 234 size_t column = 0u; |
| 235 std::string regex = | 235 std::string regex = |
| 236 base::StringPrintf("%s Line: (\\d+), column: (\\d+), Syntax error.", | 236 base::StringPrintf("%s Line: (\\d+), column: (\\d+), .*", |
| 237 manifest_errors::kManifestParseError); | 237 manifest_errors::kManifestParseError); |
| 238 // If this was a JSON parse error, we can highlight the exact line with the | 238 // If this was a JSON parse error, we can highlight the exact line with the |
| 239 // error. Otherwise, we should still display the manifest (for consistency, | 239 // error. Otherwise, we should still display the manifest (for consistency, |
| 240 // reference, and so that if we ever make this really fancy and add an editor, | 240 // reference, and so that if we ever make this really fancy and add an editor, |
| 241 // it's ready). | 241 // it's ready). |
| 242 // | 242 // |
| 243 // This regex call can fail, but if it does, we just don't highlight anything. | 243 // This regex call can fail, but if it does, we just don't highlight anything. |
| 244 re2::RE2::FullMatch(error, regex, &line, &column); | 244 re2::RE2::FullMatch(error, regex, &line, &column); |
| 245 | 245 |
| 246 // This will read the manifest and call AddFailure with the read manifest | 246 // This will read the manifest and call AddFailure with the read manifest |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 294 } |
| 295 | 295 |
| 296 void ExtensionLoaderHandler::NotifyFrontendOfFailure() { | 296 void ExtensionLoaderHandler::NotifyFrontendOfFailure() { |
| 297 web_ui()->CallJavascriptFunction( | 297 web_ui()->CallJavascriptFunction( |
| 298 "extensions.ExtensionLoader.notifyLoadFailed", | 298 "extensions.ExtensionLoader.notifyLoadFailed", |
| 299 failures_); | 299 failures_); |
| 300 failures_.Clear(); | 300 failures_.Clear(); |
| 301 } | 301 } |
| 302 | 302 |
| 303 } // namespace extensions | 303 } // namespace extensions |
| OLD | NEW |