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

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

Issue 398083002: Add "UninstallReason" parameter to ExtensionRegistryObserver::OnExtensionUninstalled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix header file. Created 6 years, 5 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/external_install_manager.h" 11 #include "chrome/browser/extensions/external_install_manager.h"
12 #include "chrome/browser/extensions/webstore_data_fetcher.h" 12 #include "chrome/browser/extensions/webstore_data_fetcher.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_finder.h" 15 #include "chrome/browser/ui/browser_finder.h"
16 #include "chrome/browser/ui/global_error/global_error.h" 16 #include "chrome/browser/ui/global_error/global_error.h"
17 #include "chrome/browser/ui/global_error/global_error_service.h" 17 #include "chrome/browser/ui/global_error/global_error_service.h"
18 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 18 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 19 #include "chrome/browser/ui/tabs/tab_strip_model.h"
20 #include "extensions/browser/extension_registry.h" 20 #include "extensions/browser/extension_registry.h"
21 #include "extensions/browser/extension_system.h" 21 #include "extensions/browser/extension_system.h"
22 #include "extensions/browser/uninstall_reason.h"
22 #include "extensions/common/constants.h" 23 #include "extensions/common/constants.h"
23 #include "extensions/common/extension.h" 24 #include "extensions/common/extension.h"
24 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
25 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/gfx/image/image.h" 27 #include "ui/gfx/image/image.h"
27 #include "ui/gfx/image/image_skia_operations.h" 28 #include "ui/gfx/image/image_skia_operations.h"
28 29
29 namespace extensions { 30 namespace extensions {
30 31
31 namespace { 32 namespace {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } else { 278 } else {
278 // ... Otherwise we have to do it explicitly. 279 // ... Otherwise we have to do it explicitly.
279 manager_->RemoveExternalInstallError(); 280 manager_->RemoveExternalInstallError();
280 } 281 }
281 } 282 }
282 283
283 void ExternalInstallError::InstallUIAbort(bool user_initiated) { 284 void ExternalInstallError::InstallUIAbort(bool user_initiated) {
284 if (user_initiated && GetExtension()) { 285 if (user_initiated && GetExtension()) {
285 ExtensionSystem::Get(browser_context_) 286 ExtensionSystem::Get(browser_context_)
286 ->extension_service() 287 ->extension_service()
287 ->UninstallExtension( 288 ->UninstallExtension(extension_id_,
288 extension_id_, 289 extensions::UNINSTALL_REASON_INSTALL_CANCELED,
289 ExtensionService::UNINSTALL_REASON_INSTALL_CANCELED, 290 NULL); // Ignore error.
290 NULL); // Ignore error.
291 // Since the manager listens for the extension to be removed, this will 291 // Since the manager listens for the extension to be removed, this will
292 // remove the error... 292 // remove the error...
293 } else { 293 } else {
294 // ... Otherwise we have to do it explicitly. 294 // ... Otherwise we have to do it explicitly.
295 manager_->RemoveExternalInstallError(); 295 manager_->RemoveExternalInstallError();
296 } 296 }
297 } 297 }
298 298
299 void ExternalInstallError::ShowDialog(Browser* browser) { 299 void ExternalInstallError::ShowDialog(Browser* browser) {
300 DCHECK(install_ui_.get()); 300 DCHECK(install_ui_.get());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 if (browser) 383 if (browser)
384 global_error_->ShowBubbleView(browser); 384 global_error_->ShowBubbleView(browser);
385 } else { 385 } else {
386 DCHECK(alert_type_ == MENU_ALERT); 386 DCHECK(alert_type_ == MENU_ALERT);
387 global_error_.reset(new ExternalInstallMenuAlert(this)); 387 global_error_.reset(new ExternalInstallMenuAlert(this));
388 error_service_->AddGlobalError(global_error_.get()); 388 error_service_->AddGlobalError(global_error_.get());
389 } 389 }
390 } 390 }
391 391
392 } // namespace extensions 392 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_toolbar_model.cc ('k') | chrome/browser/extensions/external_install_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698