| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extension_disabled_ui.h" | 5 #include "chrome/browser/extensions/extension_disabled_ui.h" |
| 6 | 6 |
| 7 #include <bitset> | 7 #include <bitset> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 12 #include "base/location.h" | 13 #include "base/location.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 16 #include "base/scoped_observer.h" | 17 #include "base/scoped_observer.h" |
| 17 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 scoped_ptr<ExtensionInstallPrompt> install_ui_; | 113 scoped_ptr<ExtensionInstallPrompt> install_ui_; |
| 113 | 114 |
| 114 ExtensionService* service_; | 115 ExtensionService* service_; |
| 115 const Extension* extension_; | 116 const Extension* extension_; |
| 116 }; | 117 }; |
| 117 | 118 |
| 118 ExtensionDisabledDialogDelegate::ExtensionDisabledDialogDelegate( | 119 ExtensionDisabledDialogDelegate::ExtensionDisabledDialogDelegate( |
| 119 ExtensionService* service, | 120 ExtensionService* service, |
| 120 scoped_ptr<ExtensionInstallPrompt> install_ui, | 121 scoped_ptr<ExtensionInstallPrompt> install_ui, |
| 121 const Extension* extension) | 122 const Extension* extension) |
| 122 : install_ui_(install_ui.Pass()), | 123 : install_ui_(std::move(install_ui)), |
| 123 service_(service), | 124 service_(service), |
| 124 extension_(extension) { | 125 extension_(extension) { |
| 125 AddRef(); // Balanced in Proceed or Abort. | 126 AddRef(); // Balanced in Proceed or Abort. |
| 126 ExtensionInstallPrompt::PromptType type = | 127 ExtensionInstallPrompt::PromptType type = |
| 127 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( | 128 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( |
| 128 service_->profile(), extension); | 129 service_->profile(), extension); |
| 129 install_ui_->ShowDialog( | 130 install_ui_->ShowDialog( |
| 130 this, extension_, nullptr, | 131 this, extension_, nullptr, |
| 131 make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)), | 132 make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)), |
| 132 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); | 133 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 extension->id(), | 505 extension->id(), |
| 505 is_remote_install)); | 506 is_remote_install)); |
| 506 } | 507 } |
| 507 | 508 |
| 508 void ShowExtensionDisabledDialog(ExtensionService* service, | 509 void ShowExtensionDisabledDialog(ExtensionService* service, |
| 509 content::WebContents* web_contents, | 510 content::WebContents* web_contents, |
| 510 const Extension* extension) { | 511 const Extension* extension) { |
| 511 scoped_ptr<ExtensionInstallPrompt> install_ui( | 512 scoped_ptr<ExtensionInstallPrompt> install_ui( |
| 512 new ExtensionInstallPrompt(web_contents)); | 513 new ExtensionInstallPrompt(web_contents)); |
| 513 // This object manages its own lifetime. | 514 // This object manages its own lifetime. |
| 514 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); | 515 new ExtensionDisabledDialogDelegate(service, std::move(install_ui), |
| 516 extension); |
| 515 } | 517 } |
| 516 | 518 |
| 517 } // namespace extensions | 519 } // namespace extensions |
| OLD | NEW |