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/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 bool ExtensionUninstallDialogDelegateView::Cancel() { | 195 bool ExtensionUninstallDialogDelegateView::Cancel() { |
196 if (dialog_) | 196 if (dialog_) |
197 dialog_->ExtensionUninstallCanceled(); | 197 dialog_->ExtensionUninstallCanceled(); |
198 return true; | 198 return true; |
199 } | 199 } |
200 | 200 |
201 string16 ExtensionUninstallDialogDelegateView::GetWindowTitle() const { | 201 string16 ExtensionUninstallDialogDelegateView::GetWindowTitle() const { |
202 return l10n_util::GetStringUTF16(IDS_EXTENSION_UNINSTALL_PROMPT_TITLE); | 202 return l10n_util::GetStringUTF16(IDS_EXTENSION_UNINSTALL_PROMPT_TITLE); |
203 } | 203 } |
204 | 204 |
205 | |
206 gfx::Size ExtensionUninstallDialogDelegateView::GetPreferredSize() { | 205 gfx::Size ExtensionUninstallDialogDelegateView::GetPreferredSize() { |
207 int width = kRightColumnWidth; | 206 int width = kRightColumnWidth; |
208 width += kIconSize; | 207 width += kIconSize; |
209 width += views::kPanelHorizMargin * 3; | 208 width += views::kPanelHorizMargin * 3; |
msw
2013/04/16 01:58:24
Shouldn't this depend on DialogDelegate::UseNewSty
Evan Stade
2013/04/16 19:58:25
Done.
| |
210 | 209 |
211 int height = views::kPanelVertMargin * 2; | 210 int height = views::kPanelVertMargin * 2; |
212 height += heading_->GetHeightForWidth(kRightColumnWidth); | 211 height += heading_->GetHeightForWidth(kRightColumnWidth); |
213 | 212 |
214 return gfx::Size(width, | 213 return gfx::Size(width, |
215 std::max(height, kIconSize + views::kPanelVertMargin * 2)); | 214 std::max(height, kIconSize + views::kPanelVertMargin * 2)); |
216 } | 215 } |
217 | 216 |
218 void ExtensionUninstallDialogDelegateView::Layout() { | 217 void ExtensionUninstallDialogDelegateView::Layout() { |
219 int x = views::kPanelHorizMargin; | 218 int x = DialogDelegate::UseNewStyle() ? views::kButtonHEdgeMarginNew : |
219 views::kPanelHorizMargin; | |
220 int y = views::kPanelVertMargin; | 220 int y = views::kPanelVertMargin; |
221 | 221 |
222 heading_->SizeToFit(kRightColumnWidth); | 222 heading_->SizeToFit(kRightColumnWidth); |
223 | 223 |
224 if (heading_->height() <= kIconSize) { | 224 if (heading_->height() <= kIconSize) { |
225 icon_->SetBounds(x, y, kIconSize, kIconSize); | 225 icon_->SetBounds(x, y, kIconSize, kIconSize); |
226 x += kIconSize; | 226 x += kIconSize; |
227 x += views::kPanelHorizMargin; | 227 x += views::kPanelHorizMargin; |
msw
2013/04/16 01:58:24
Should this optionally use views::kButtonHEdgeMarg
Evan Stade
2013/04/16 19:58:25
actually it should use a different constant (fixed
| |
228 | 228 |
229 heading_->SetX(x); | 229 heading_->SetX(x); |
230 heading_->SetY(y + (kIconSize - heading_->height()) / 2); | 230 heading_->SetY(y + (kIconSize - heading_->height()) / 2); |
231 } else { | 231 } else { |
232 icon_->SetBounds(x, | 232 icon_->SetBounds(x, |
233 y + (heading_->height() - kIconSize) / 2, | 233 y + (heading_->height() - kIconSize) / 2, |
234 kIconSize, | 234 kIconSize, |
235 kIconSize); | 235 kIconSize); |
236 x += kIconSize; | 236 x += kIconSize; |
237 x += views::kPanelHorizMargin; | 237 x += views::kPanelHorizMargin; |
msw
2013/04/16 01:58:24
Should this optionally use views::kButtonHEdgeMarg
Evan Stade
2013/04/16 19:58:25
ditto
| |
238 | 238 |
239 heading_->SetX(x); | 239 heading_->SetX(x); |
240 heading_->SetY(y); | 240 heading_->SetY(y); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 } // namespace | 244 } // namespace |
245 | 245 |
246 // static | 246 // static |
247 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( | 247 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( |
248 Profile* profile, | 248 Profile* profile, |
249 Browser* browser, | 249 Browser* browser, |
250 Delegate* delegate) { | 250 Delegate* delegate) { |
251 return new ExtensionUninstallDialogViews(profile, browser, delegate); | 251 return new ExtensionUninstallDialogViews(profile, browser, delegate); |
252 } | 252 } |
OLD | NEW |