OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
9 #include "chrome/browser/browser_window.h" | 9 #include "chrome/browser/browser_window.h" |
10 #include "chrome/browser/extensions/extension_install_ui.h" | 10 #include "chrome/browser/extensions/extension_install_ui.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // Width of the vertical padding inside the permission box border. | 43 // Width of the vertical padding inside the permission box border. |
44 const int kPermissionBoxVerticalPadding = 11; | 44 const int kPermissionBoxVerticalPadding = 11; |
45 | 45 |
46 // The max width of the individual permission strings inside the permission | 46 // The max width of the individual permission strings inside the permission |
47 // box. | 47 // box. |
48 const int kPermissionLabelWidth = | 48 const int kPermissionLabelWidth = |
49 kPermissionBoxWidth - | 49 kPermissionBoxWidth - |
50 kPermissionBoxBorderWidth * 2 - | 50 kPermissionBoxBorderWidth * 2 - |
51 kPermissionBoxHorizontalPadding * 2; | 51 kPermissionBoxHorizontalPadding * 2; |
52 | 52 |
| 53 // Heading font size correction. |
| 54 #if defined(CROS_FONTS_USING_BCI) |
| 55 const int kHeadingFontSizeDelta = 0; |
| 56 #else |
| 57 const int kHeadingFontSizeDelta = 1; |
| 58 #endif |
| 59 |
53 } // namespace | 60 } // namespace |
54 | 61 |
55 | 62 |
56 // Implements the extension installation prompt for TOOLKIT_VIEWS. | 63 // Implements the extension installation prompt for TOOLKIT_VIEWS. |
57 class InstallDialogContent2 | 64 class InstallDialogContent2 |
58 : public views::View, public views::DialogDelegate { | 65 : public views::View, public views::DialogDelegate { |
59 public: | 66 public: |
60 InstallDialogContent2(ExtensionInstallUI::Delegate* delegate, | 67 InstallDialogContent2(ExtensionInstallUI::Delegate* delegate, |
61 const Extension* extension, | 68 const Extension* extension, |
62 SkBitmap* icon, | 69 SkBitmap* icon, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 icon_ = new views::ImageView(); | 131 icon_ = new views::ImageView(); |
125 icon_->SetImageSize(size); | 132 icon_->SetImageSize(size); |
126 icon_->SetImage(*icon); | 133 icon_->SetImage(*icon); |
127 icon_->SetHorizontalAlignment(views::ImageView::CENTER); | 134 icon_->SetHorizontalAlignment(views::ImageView::CENTER); |
128 icon_->SetVerticalAlignment(views::ImageView::CENTER); | 135 icon_->SetVerticalAlignment(views::ImageView::CENTER); |
129 AddChildView(icon_); | 136 AddChildView(icon_); |
130 | 137 |
131 heading_ = new views::Label( | 138 heading_ = new views::Label( |
132 l10n_util::GetStringF(IDS_EXTENSION_INSTALL_PROMPT_HEADING, | 139 l10n_util::GetStringF(IDS_EXTENSION_INSTALL_PROMPT_HEADING, |
133 UTF8ToWide(extension->name()))); | 140 UTF8ToWide(extension->name()))); |
134 heading_->SetFont(heading_->font().DeriveFont(1, gfx::Font::BOLD)); | 141 heading_->SetFont(heading_->font().DeriveFont(kHeadingFontSizeDelta, |
| 142 gfx::Font::BOLD)); |
135 heading_->SetMultiLine(true); | 143 heading_->SetMultiLine(true); |
136 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 144 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
137 AddChildView(heading_); | 145 AddChildView(heading_); |
138 | 146 |
139 if (permissions.size() == 0) { | 147 if (permissions.size() == 0) { |
140 right_column_width_ = kNoPermissionsRightColumnWidth; | 148 right_column_width_ = kNoPermissionsRightColumnWidth; |
141 } else { | 149 } else { |
142 right_column_width_ = kPermissionBoxWidth; | 150 right_column_width_ = kPermissionBoxWidth; |
143 will_have_access_to_ = new views::Label( | 151 will_have_access_to_ = new views::Label( |
144 l10n_util::GetString(IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO)); | 152 l10n_util::GetString(IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO)); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 BrowserWindow* window = browser->window(); | 317 BrowserWindow* window = browser->window(); |
310 if (!window) { | 318 if (!window) { |
311 delegate->InstallUIAbort(); | 319 delegate->InstallUIAbort(); |
312 return; | 320 return; |
313 } | 321 } |
314 | 322 |
315 browser::CreateViewsWindow(window->GetNativeHandle(), gfx::Rect(), | 323 browser::CreateViewsWindow(window->GetNativeHandle(), gfx::Rect(), |
316 new InstallDialogContent2(delegate, extension, icon, permissions)) | 324 new InstallDialogContent2(delegate, extension, icon, permissions)) |
317 ->Show(); | 325 ->Show(); |
318 } | 326 } |
OLD | NEW |