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_uninstall_dialog.h" | 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 gfx::ImageSkia* image); | 74 gfx::ImageSkia* image); |
75 ~ExtensionUninstallDialogDelegateView() override; | 75 ~ExtensionUninstallDialogDelegateView() override; |
76 | 76 |
77 // Called when the ExtensionUninstallDialog has been destroyed to make sure | 77 // Called when the ExtensionUninstallDialog has been destroyed to make sure |
78 // we invalidate pointers. | 78 // we invalidate pointers. |
79 void DialogDestroyed() { dialog_ = NULL; } | 79 void DialogDestroyed() { dialog_ = NULL; } |
80 | 80 |
81 private: | 81 private: |
82 // views::DialogDelegate: | 82 // views::DialogDelegate: |
83 views::View* CreateExtraView() override; | 83 views::View* CreateExtraView() override; |
| 84 bool GetExtraViewPadding(int* padding) override; |
84 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 85 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
85 int GetDefaultDialogButton() const override { | 86 int GetDefaultDialogButton() const override { |
86 // Default to accept when triggered via chrome://extensions page. | 87 // Default to accept when triggered via chrome://extensions page. |
87 return triggered_by_extension_ ? | 88 return triggered_by_extension_ ? |
88 ui::DIALOG_BUTTON_CANCEL : ui::DIALOG_BUTTON_OK; | 89 ui::DIALOG_BUTTON_CANCEL : ui::DIALOG_BUTTON_OK; |
89 } | 90 } |
90 bool Accept() override; | 91 bool Accept() override; |
91 bool Cancel() override; | 92 bool Cancel() override; |
92 | 93 |
93 // views::WidgetDelegate: | 94 // views::WidgetDelegate: |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 197 } |
197 | 198 |
198 views::View* ExtensionUninstallDialogDelegateView::CreateExtraView() { | 199 views::View* ExtensionUninstallDialogDelegateView::CreateExtraView() { |
199 if (dialog_->ShouldShowReportAbuseCheckbox()) { | 200 if (dialog_->ShouldShowReportAbuseCheckbox()) { |
200 report_abuse_checkbox_ = new views::Checkbox( | 201 report_abuse_checkbox_ = new views::Checkbox( |
201 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_UNINSTALL_REPORT_ABUSE)); | 202 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_UNINSTALL_REPORT_ABUSE)); |
202 } | 203 } |
203 return report_abuse_checkbox_; | 204 return report_abuse_checkbox_; |
204 } | 205 } |
205 | 206 |
| 207 bool ExtensionUninstallDialogDelegateView::GetExtraViewPadding(int* padding) { |
| 208 // We want a little more padding between the "report abuse" checkbox and the |
| 209 // buttons. |
| 210 *padding = views::kUnrelatedControlLargeHorizontalSpacing; |
| 211 return true; |
| 212 } |
| 213 |
206 base::string16 ExtensionUninstallDialogDelegateView::GetDialogButtonLabel( | 214 base::string16 ExtensionUninstallDialogDelegateView::GetDialogButtonLabel( |
207 ui::DialogButton button) const { | 215 ui::DialogButton button) const { |
208 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? | 216 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? |
209 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON : IDS_CANCEL); | 217 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON : IDS_CANCEL); |
210 } | 218 } |
211 | 219 |
212 bool ExtensionUninstallDialogDelegateView::Accept() { | 220 bool ExtensionUninstallDialogDelegateView::Accept() { |
213 if (dialog_) { | 221 if (dialog_) { |
214 dialog_->ExtensionUninstallAccepted( | 222 dialog_->ExtensionUninstallAccepted( |
215 report_abuse_checkbox_ && report_abuse_checkbox_->checked()); | 223 report_abuse_checkbox_ && report_abuse_checkbox_->checked()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 276 |
269 } // namespace | 277 } // namespace |
270 | 278 |
271 // static | 279 // static |
272 extensions::ExtensionUninstallDialog* | 280 extensions::ExtensionUninstallDialog* |
273 extensions::ExtensionUninstallDialog::Create(Profile* profile, | 281 extensions::ExtensionUninstallDialog::Create(Profile* profile, |
274 gfx::NativeWindow parent, | 282 gfx::NativeWindow parent, |
275 Delegate* delegate) { | 283 Delegate* delegate) { |
276 return new ExtensionUninstallDialogViews(profile, parent, delegate); | 284 return new ExtensionUninstallDialogViews(profile, parent, delegate); |
277 } | 285 } |
OLD | NEW |