OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/browser_list.h" | 9 #include "chrome/browser/browser_list.h" |
10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 | 29 |
30 const int kRightColumnWidth = 270; | 30 const int kRightColumnWidth = 270; |
31 const int kIconSize = 85; | 31 const int kIconSize = 85; |
32 | 32 |
33 // Implements the extension installation prompt for Windows. | 33 // Implements the extension installation prompt for Windows. |
34 class InstallDialogContent : public views::View, public views::DialogDelegate { | 34 class InstallDialogContent : public views::View, public views::DialogDelegate { |
35 public: | 35 public: |
36 InstallDialogContent(ExtensionInstallUI::Delegate* delegate, | 36 InstallDialogContent(ExtensionInstallUI::Delegate* delegate, |
37 Extension* extension, SkBitmap* icon, const std::wstring& warning_text) | 37 Extension* extension, SkBitmap* icon, const std::wstring& warning_text) |
38 : delegate_(delegate), icon_(NULL) { | 38 : delegate_(delegate), icon_(NULL) { |
39 // Scale down to 85x85, but allow smaller icons (don't scale up). | |
rafaelw
2009/10/28 19:21:32
Can you create bugs to match this behavior on linu
| |
40 gfx::Size size(icon->width(), icon->height()); | |
41 if (size.width() > kIconSize || size.height() > kIconSize) | |
42 size = gfx::Size(kIconSize, kIconSize); | |
39 icon_ = new views::ImageView(); | 43 icon_ = new views::ImageView(); |
40 icon_->SetImageSize(gfx::Size(kIconSize, kIconSize)); | 44 icon_->SetImageSize(size); |
41 icon_->SetImage(*icon); | 45 icon_->SetImage(*icon); |
42 AddChildView(icon_); | 46 AddChildView(icon_); |
43 | 47 |
44 heading_ = new views::Label( | 48 heading_ = new views::Label( |
45 l10n_util::GetStringF(IDS_EXTENSION_PROMPT_HEADING, | 49 l10n_util::GetStringF(IDS_EXTENSION_PROMPT_HEADING, |
46 UTF8ToWide(extension->name()))); | 50 UTF8ToWide(extension->name()))); |
47 heading_->SetFont(heading_->GetFont().DeriveFont(1, gfx::Font::BOLD)); | 51 heading_->SetFont(heading_->GetFont().DeriveFont(1, gfx::Font::BOLD)); |
48 heading_->SetMultiLine(true); | 52 heading_->SetMultiLine(true); |
49 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 53 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
50 AddChildView(heading_); | 54 AddChildView(heading_); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 void ExtensionInstallUI::ShowExtensionInstallError(const std::string& error) { | 167 void ExtensionInstallUI::ShowExtensionInstallError(const std::string& error) { |
164 #if defined(OS_WIN) | 168 #if defined(OS_WIN) |
165 win_util::MessageBox(NULL, UTF8ToWide(error), | 169 win_util::MessageBox(NULL, UTF8ToWide(error), |
166 l10n_util::GetString(IDS_EXTENSION_INSTALL_FAILURE_TITLE), | 170 l10n_util::GetString(IDS_EXTENSION_INSTALL_FAILURE_TITLE), |
167 MB_OK | MB_SETFOREGROUND); | 171 MB_OK | MB_SETFOREGROUND); |
168 #else | 172 #else |
169 // TODO(port): Port this over to OS_* | 173 // TODO(port): Port this over to OS_* |
170 NOTREACHED(); | 174 NOTREACHED(); |
171 #endif | 175 #endif |
172 } | 176 } |
OLD | NEW |