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

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

Issue 2885143003: [Extensions] Remove external errors on profile shutdown (Closed)
Patch Set: . Created 3 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 | « no previous file | chrome/browser/extensions/external_install_error_browsertest.cc » ('j') | 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/extensions/external_install_error.h" 5 #include "chrome/browser/extensions/external_install_error.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/extensions/external_install_manager.h" 21 #include "chrome/browser/extensions/external_install_manager.h"
22 #include "chrome/browser/extensions/webstore_data_fetcher.h" 22 #include "chrome/browser/extensions/webstore_data_fetcher.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
25 #include "chrome/browser/ui/browser_finder.h" 25 #include "chrome/browser/ui/browser_finder.h"
26 #include "chrome/browser/ui/global_error/global_error.h" 26 #include "chrome/browser/ui/global_error/global_error.h"
27 #include "chrome/browser/ui/global_error/global_error_service.h" 27 #include "chrome/browser/ui/global_error/global_error_service.h"
28 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 28 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
29 #include "chrome/browser/ui/tabs/tab_strip_model.h" 29 #include "chrome/browser/ui/tabs/tab_strip_model.h"
30 #include "chrome/grit/generated_resources.h" 30 #include "chrome/grit/generated_resources.h"
31 #include "components/keyed_service/content/browser_context_dependency_manager.h"
31 #include "content/public/browser/storage_partition.h" 32 #include "content/public/browser/storage_partition.h"
32 #include "extensions/browser/extension_registry.h" 33 #include "extensions/browser/extension_registry.h"
33 #include "extensions/browser/extension_system.h" 34 #include "extensions/browser/extension_system.h"
34 #include "extensions/browser/uninstall_reason.h" 35 #include "extensions/browser/uninstall_reason.h"
35 #include "extensions/common/constants.h" 36 #include "extensions/common/constants.h"
36 #include "extensions/common/extension.h" 37 #include "extensions/common/extension.h"
37 #include "ui/base/l10n/l10n_util.h" 38 #include "ui/base/l10n/l10n_util.h"
38 #include "ui/gfx/image/image.h" 39 #include "ui/gfx/image/image.h"
39 #include "ui/gfx/image/image_skia.h" 40 #include "ui/gfx/image/image_skia.h"
40 #include "ui/gfx/image/image_skia_operations.h" 41 #include "ui/gfx/image/image_skia_operations.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 306
306 webstore_data_fetcher_.reset(new WebstoreDataFetcher( 307 webstore_data_fetcher_.reset(new WebstoreDataFetcher(
307 this, 308 this,
308 content::BrowserContext::GetDefaultStoragePartition(browser_context_)-> 309 content::BrowserContext::GetDefaultStoragePartition(browser_context_)->
309 GetURLRequestContext(), 310 GetURLRequestContext(),
310 GURL(), extension_id_)); 311 GURL(), extension_id_));
311 webstore_data_fetcher_->Start(); 312 webstore_data_fetcher_->Start();
312 } 313 }
313 314
314 ExternalInstallError::~ExternalInstallError() { 315 ExternalInstallError::~ExternalInstallError() {
316 #if DCHECK_IS_ON()
Finnur 2017/05/17 16:15:11 Why the #if check?
Devlin 2017/05/17 16:17:26 Just to avoid the production cost. Since we shoul
317 // Errors should only be removed while the profile is valid, since removing
318 // the error can trigger other subsystems listening for changes.
319 BrowserContextDependencyManager::GetInstance()
320 ->AssertBrowserContextWasntDestroyed(browser_context_);
321 #endif
315 if (global_error_.get()) 322 if (global_error_.get())
316 error_service_->RemoveUnownedGlobalError(global_error_.get()); 323 error_service_->RemoveUnownedGlobalError(global_error_.get());
317 } 324 }
318 325
319 void ExternalInstallError::OnInstallPromptDone( 326 void ExternalInstallError::OnInstallPromptDone(
320 ExtensionInstallPrompt::Result result) { 327 ExtensionInstallPrompt::Result result) {
321 const Extension* extension = GetExtension(); 328 const Extension* extension = GetExtension();
322 329
323 // If the error isn't removed and deleted as part of handling the user's 330 // If the error isn't removed and deleted as part of handling the user's
324 // response (which can happen, e.g., if an uninstall fails), be sure to remove 331 // response (which can happen, e.g., if an uninstall fails), be sure to remove
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 global_error_.reset(new ExternalInstallMenuAlert(this)); 463 global_error_.reset(new ExternalInstallMenuAlert(this));
457 error_service_->AddUnownedGlobalError(global_error_.get()); 464 error_service_->AddUnownedGlobalError(global_error_.get());
458 } 465 }
459 } 466 }
460 467
461 void ExternalInstallError::RemoveError() { 468 void ExternalInstallError::RemoveError() {
462 manager_->RemoveExternalInstallError(extension_id_); 469 manager_->RemoveExternalInstallError(extension_id_);
463 } 470 }
464 471
465 } // namespace extensions 472 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/external_install_error_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698