| 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_install_prompt.h" | 5 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 extensions::util::GetDefaultExtensionIcon(); | 147 extensions::util::GetDefaultExtensionIcon(); |
| 148 return image.GetRepresentation( | 148 return image.GetRepresentation( |
| 149 gfx::ImageSkia::GetMaxSupportedScale()).sk_bitmap(); | 149 gfx::ImageSkia::GetMaxSupportedScale()).sk_bitmap(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 // If auto confirm is enabled then posts a task to proceed with or cancel the | 152 // If auto confirm is enabled then posts a task to proceed with or cancel the |
| 153 // install and returns true. Otherwise returns false. | 153 // install and returns true. Otherwise returns false. |
| 154 bool AutoConfirmPrompt(ExtensionInstallPrompt::Delegate* delegate) { | 154 bool AutoConfirmPrompt(ExtensionInstallPrompt::Delegate* delegate) { |
| 155 switch (extensions::ScopedTestDialogAutoConfirm::GetAutoConfirmValue()) { | 155 switch (extensions::ScopedTestDialogAutoConfirm::GetAutoConfirmValue()) { |
| 156 case extensions::ScopedTestDialogAutoConfirm::NONE: | 156 case extensions::ScopedTestDialogAutoConfirm::NONE: |
| 157 LOG(WARNING) << "None!"; | |
| 158 return false; | 157 return false; |
| 159 // We use PostTask instead of calling the delegate directly here, because in | 158 // We use PostTask instead of calling the delegate directly here, because in |
| 160 // the real implementations it's highly likely the message loop will be | 159 // the real implementations it's highly likely the message loop will be |
| 161 // pumping a few times before the user clicks accept or cancel. | 160 // pumping a few times before the user clicks accept or cancel. |
| 162 case extensions::ScopedTestDialogAutoConfirm::ACCEPT: | 161 case extensions::ScopedTestDialogAutoConfirm::ACCEPT: |
| 163 LOG(WARNING) << "Proceeding!"; | |
| 164 base::MessageLoop::current()->PostTask( | 162 base::MessageLoop::current()->PostTask( |
| 165 FROM_HERE, | 163 FROM_HERE, |
| 166 base::Bind(&ExtensionInstallPrompt::Delegate::InstallUIProceed, | 164 base::Bind(&ExtensionInstallPrompt::Delegate::InstallUIProceed, |
| 167 base::Unretained(delegate))); | 165 base::Unretained(delegate))); |
| 168 return true; | 166 return true; |
| 169 case extensions::ScopedTestDialogAutoConfirm::CANCEL: | 167 case extensions::ScopedTestDialogAutoConfirm::CANCEL: |
| 170 LOG(WARNING) << "Canceling!"; | |
| 171 base::ThreadTaskRunnerHandle::Get()->PostTask( | 168 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 172 FROM_HERE, | 169 FROM_HERE, |
| 173 base::Bind(&ExtensionInstallPrompt::Delegate::InstallUIAbort, | 170 base::Bind(&ExtensionInstallPrompt::Delegate::InstallUIAbort, |
| 174 base::Unretained(delegate), | 171 base::Unretained(delegate), |
| 175 true)); | 172 true)); |
| 176 return true; | 173 return true; |
| 177 } | 174 } |
| 178 | 175 |
| 179 NOTREACHED(); | 176 NOTREACHED(); |
| 180 return false; | 177 return false; |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 if (show_params_->WasParentDestroyed()) { | 931 if (show_params_->WasParentDestroyed()) { |
| 935 delegate_->InstallUIAbort(false); | 932 delegate_->InstallUIAbort(false); |
| 936 return; | 933 return; |
| 937 } | 934 } |
| 938 | 935 |
| 939 if (show_dialog_callback_.is_null()) | 936 if (show_dialog_callback_.is_null()) |
| 940 GetDefaultShowDialogCallback().Run(show_params_.get(), delegate_, prompt_); | 937 GetDefaultShowDialogCallback().Run(show_params_.get(), delegate_, prompt_); |
| 941 else | 938 else |
| 942 show_dialog_callback_.Run(show_params_.get(), delegate_, prompt_); | 939 show_dialog_callback_.Run(show_params_.get(), delegate_, prompt_); |
| 943 } | 940 } |
| OLD | NEW |