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

Side by Side Diff: chrome/browser/extensions/unpacked_installer.cc

Issue 252593003: Improve UI for unpacked extensions failing to load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/unpacked_installer.h" 5 #include "chrome/browser/extensions/unpacked_installer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 extension_path_, 278 extension_path_,
279 installer_.extension()->manifest()->value(), 279 installer_.extension()->manifest()->value(),
280 &error)) { 280 &error)) {
281 BrowserThread::PostTask( 281 BrowserThread::PostTask(
282 BrowserThread::UI, 282 BrowserThread::UI,
283 FROM_HERE, 283 FROM_HERE,
284 base::Bind(&UnpackedInstaller::ReportExtensionLoadError, this, error)); 284 base::Bind(&UnpackedInstaller::ReportExtensionLoadError, this, error));
285 return; 285 return;
286 } 286 }
287 287
288 // The installation prompt is about to be shown, which means we're past the
289 // point of detecting installation errors. We can now safely remove the retry
290 // handler that listens for them.
291 BrowserThread::PostTask(
292 BrowserThread::UI,
293 FROM_HERE,
294 base::Bind(&UnpackedInstaller::UnregisterLoadRetryListener, this));
295
296 BrowserThread::PostTask( 288 BrowserThread::PostTask(
297 BrowserThread::UI, 289 BrowserThread::UI,
298 FROM_HERE, 290 FROM_HERE,
299 base::Bind(&UnpackedInstaller::ShowInstallPrompt, this)); 291 base::Bind(&UnpackedInstaller::ShowInstallPrompt, this));
300 } 292 }
301 293
302 void UnpackedInstaller::UnregisterLoadRetryListener() { 294 void UnpackedInstaller::ReportExtensionLoadError(const std::string &error) {
303 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 295 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
296 if (!on_failure_callback_.is_null())
297 on_failure_callback_.Run(extension_path_, error);
298
304 if (!service_weak_.get()) 299 if (!service_weak_.get())
305 return; 300 return;
not at google - send to devlin 2014/04/25 17:10:20 this file is quite broken, but I'm scared to touch
Devlin 2014/04/25 18:13:12 Done.
306 service_weak_->NotifyLoadRetry(false, extension_path_); 301 service_weak_->ReportExtensionLoadError(extension_path_, error);
307 }
308
309 void UnpackedInstaller::ReportExtensionLoadError(const std::string &error) {
310 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
311 if (!service_weak_.get())
312 return;
313 service_weak_->ReportExtensionLoadError(extension_path_, error, true);
314 } 302 }
315 303
316 void UnpackedInstaller::ConfirmInstall() { 304 void UnpackedInstaller::ConfirmInstall() {
317 DCHECK_CURRENTLY_ON(BrowserThread::UI); 305 DCHECK_CURRENTLY_ON(BrowserThread::UI);
318 base::string16 error = installer_.CheckManagementPolicy(); 306 base::string16 error = installer_.CheckManagementPolicy();
319 if (!error.empty()) { 307 if (!error.empty()) {
320 ReportExtensionLoadError(base::UTF16ToUTF8(error)); 308 ReportExtensionLoadError(base::UTF16ToUTF8(error));
321 return; 309 return;
322 } 310 }
323 311
324 PermissionsUpdater perms_updater(service_weak_->profile()); 312 PermissionsUpdater perms_updater(service_weak_->profile());
325 perms_updater.GrantActivePermissions(installer_.extension().get()); 313 perms_updater.GrantActivePermissions(installer_.extension().get());
326 314
327 service_weak_->OnExtensionInstalled( 315 service_weak_->OnExtensionInstalled(
328 installer_.extension().get(), 316 installer_.extension().get(),
329 syncer::StringOrdinal(), 317 syncer::StringOrdinal(),
330 false /* no requirement errors */, 318 false /* no requirement errors */,
331 NOT_BLACKLISTED, 319 NOT_BLACKLISTED,
332 false /* don't wait for idle */); 320 false /* don't wait for idle */);
333 } 321 }
334 322
335 } // namespace extensions 323 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698