Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_loader_handler.cc

Issue 263643005: Move ExtensionService::ReportExtensionLoadError to ExtensionErrorReporter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/unpacked_installer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 LoadUnpackedExtensionImpl(failed_path_); 180 LoadUnpackedExtensionImpl(failed_path_);
181 } 181 }
182 182
183 void ExtensionLoaderHandler::LoadUnpackedExtensionImpl( 183 void ExtensionLoaderHandler::LoadUnpackedExtensionImpl(
184 const base::FilePath& file_path) { 184 const base::FilePath& file_path) {
185 scoped_refptr<UnpackedInstaller> installer = UnpackedInstaller::Create( 185 scoped_refptr<UnpackedInstaller> installer = UnpackedInstaller::Create(
186 ExtensionSystem::Get(profile_)->extension_service()); 186 ExtensionSystem::Get(profile_)->extension_service());
187 installer->set_on_failure_callback( 187 installer->set_on_failure_callback(
188 base::Bind(&ExtensionLoaderHandler::OnLoadFailure, 188 base::Bind(&ExtensionLoaderHandler::OnLoadFailure,
189 weak_ptr_factory_.GetWeakPtr())); 189 weak_ptr_factory_.GetWeakPtr()));
190
191 // We do our own error handling, so we don't want a load failure to trigger
192 // a dialog.
193 installer->set_be_noisy_on_failure(false);
194
190 installer->Load(file_path); 195 installer->Load(file_path);
191 } 196 }
192 197
193 void ExtensionLoaderHandler::OnLoadFailure(const base::FilePath& file_path, 198 void ExtensionLoaderHandler::OnLoadFailure(const base::FilePath& file_path,
194 const std::string& error) { 199 const std::string& error) {
195 failed_path_ = file_path; 200 failed_path_ = file_path;
196 size_t line = 0u; 201 size_t line = 0u;
197 size_t column = 0u; 202 size_t column = 0u;
198 std::string regex = 203 std::string regex =
199 base::StringPrintf("%s Line: (\\d+), column: (\\d+), Syntax error.", 204 base::StringPrintf("%s Line: (\\d+), column: (\\d+), Syntax error.",
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 base::StringValue file_value(file_path.LossyDisplayName()); 237 base::StringValue file_value(file_path.LossyDisplayName());
233 base::StringValue error_value(base::UTF8ToUTF16(error)); 238 base::StringValue error_value(base::UTF8ToUTF16(error));
234 web_ui()->CallJavascriptFunction( 239 web_ui()->CallJavascriptFunction(
235 "extensions.ExtensionLoader.notifyLoadFailed", 240 "extensions.ExtensionLoader.notifyLoadFailed",
236 file_value, 241 file_value,
237 error_value, 242 error_value,
238 manifest_value); 243 manifest_value);
239 } 244 }
240 245
241 } // namespace extensions 246 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/unpacked_installer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698