| 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/ui/extensions/extension_enable_flow.h" | 5 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 service->EnableExtension(extension_id_); | 111 service->EnableExtension(extension_id_); |
| 112 | 112 |
| 113 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. | 113 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. |
| 114 return; | 114 return; |
| 115 } | 115 } |
| 116 | 116 |
| 117 CreatePrompt(); | 117 CreatePrompt(); |
| 118 ExtensionInstallPrompt::PromptType type = | 118 ExtensionInstallPrompt::PromptType type = |
| 119 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(profile_, | 119 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(profile_, |
| 120 extension); | 120 extension); |
| 121 prompt_->ShowDialog( | 121 prompt_->ShowDialog(base::Bind(&ExtensionEnableFlow::InstallPromptDone, |
| 122 base::Bind(&ExtensionEnableFlow::InstallPromptDone, | 122 weak_ptr_factory_.GetWeakPtr()), |
| 123 weak_ptr_factory_.GetWeakPtr()), | 123 extension, nullptr, |
| 124 extension, nullptr, | 124 base::MakeUnique<ExtensionInstallPrompt::Prompt>(type), |
| 125 base::WrapUnique(new ExtensionInstallPrompt::Prompt(type)), | 125 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); |
| 126 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); | |
| 127 } | 126 } |
| 128 | 127 |
| 129 void ExtensionEnableFlow::CreatePrompt() { | 128 void ExtensionEnableFlow::CreatePrompt() { |
| 130 if (!window_getter_.is_null()) | 129 if (!window_getter_.is_null()) |
| 131 parent_window_ = window_getter_.Run(); | 130 parent_window_ = window_getter_.Run(); |
| 132 prompt_.reset(parent_contents_ ? | 131 prompt_.reset(parent_contents_ ? |
| 133 new ExtensionInstallPrompt(parent_contents_) : | 132 new ExtensionInstallPrompt(parent_contents_) : |
| 134 new ExtensionInstallPrompt(profile_, parent_window_)); | 133 new ExtensionInstallPrompt(profile_, parent_window_)); |
| 135 } | 134 } |
| 136 | 135 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 188 } |
| 190 | 189 |
| 191 service->GrantPermissionsAndEnableExtension(extension); | 190 service->GrantPermissionsAndEnableExtension(extension); |
| 192 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. | 191 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. |
| 193 } else { | 192 } else { |
| 194 delegate_->ExtensionEnableFlowAborted( | 193 delegate_->ExtensionEnableFlowAborted( |
| 195 result == ExtensionInstallPrompt::Result::USER_CANCELED); | 194 result == ExtensionInstallPrompt::Result::USER_CANCELED); |
| 196 // |delegate_| may delete us. | 195 // |delegate_| may delete us. |
| 197 } | 196 } |
| 198 } | 197 } |
| OLD | NEW |