| Index: chrome/browser/views/extensions/extension_install_prompt.cc
|
| diff --git a/chrome/browser/views/extensions/extension_install_prompt.cc b/chrome/browser/views/extensions/extension_install_prompt.cc
|
| index 6c589149238186d2e6316bd2394e3a406cbf2490..cc7d41c31b97ff1cf749f7da6f30f016b5e61df9 100644
|
| --- a/chrome/browser/views/extensions/extension_install_prompt.cc
|
| +++ b/chrome/browser/views/extensions/extension_install_prompt.cc
|
| @@ -23,24 +23,18 @@ class Profile;
|
|
|
| namespace {
|
|
|
| -const int kRightColumnWidth = 290;
|
| +const int kRightColumnWidth = 270;
|
| +const int kIconSize = 85;
|
|
|
| // Implements the extension installation prompt for Windows.
|
| -// TODO(aa): It would be cool to add an "extensions threat level" when we have
|
| -// granular permissions implemented:
|
| -// - red: npapi
|
| -// - orange: access to any domains
|
| -// - yellow: access to browser data
|
| -// - green: nothing
|
| -// We could have a collection of funny descriptions for each color.
|
| class InstallDialogContent : public views::View, public views::DialogDelegate {
|
| public:
|
| InstallDialogContent(ExtensionInstallUI::Delegate* delegate,
|
| - Extension* extension,
|
| - SkBitmap* icon)
|
| - : delegate_(delegate), icon_(NULL) {
|
| + Extension* extension, SkBitmap* icon, const std::wstring& warning_text)
|
| + : delegate_(delegate), icon_(NULL) {
|
| if (icon) {
|
| icon_ = new views::ImageView();
|
| + icon_->SetImageSize(gfx::Size(kIconSize, kIconSize));
|
| icon_->SetImage(*icon);
|
| AddChildView(icon_);
|
| }
|
| @@ -53,25 +47,10 @@ class InstallDialogContent : public views::View, public views::DialogDelegate {
|
| heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
|
| AddChildView(heading_);
|
|
|
| - // Pick a random warning.
|
| - std::wstring warnings[] = {
|
| - l10n_util::GetString(IDS_EXTENSION_PROMPT_WARNING_1),
|
| - l10n_util::GetString(IDS_EXTENSION_PROMPT_WARNING_2),
|
| - l10n_util::GetString(IDS_EXTENSION_PROMPT_WARNING_3)
|
| - };
|
| - warning_ = new views::Label(
|
| - warnings[base::RandInt(0, arraysize(warnings) - 1)]);
|
| + warning_ = new views::Label(warning_text);
|
| warning_->SetMultiLine(true);
|
| warning_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
|
| AddChildView(warning_);
|
| -
|
| - severe_ = new views::Label(
|
| - l10n_util::GetString(IDS_EXTENSION_PROMPT_WARNING_SEVERE));
|
| - severe_->SetMultiLine(true);
|
| - severe_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
|
| - severe_->SetFont(heading_->GetFont().DeriveFont(0, gfx::Font::BOLD));
|
| - severe_->SetColor(SK_ColorRED);
|
| - AddChildView(severe_);
|
| }
|
|
|
| private:
|
| @@ -116,7 +95,7 @@ class InstallDialogContent : public views::View, public views::DialogDelegate {
|
| int width = kRightColumnWidth + kPanelHorizMargin + kPanelHorizMargin;
|
|
|
| if (icon_) {
|
| - width += Extension::EXTENSION_ICON_LARGE;
|
| + width += kIconSize;
|
| width += kPanelHorizMargin;
|
| }
|
|
|
| @@ -125,11 +104,8 @@ class InstallDialogContent : public views::View, public views::DialogDelegate {
|
| height += kPanelVertMargin;
|
| height += warning_->GetHeightForWidth(kRightColumnWidth);
|
| height += kPanelVertMargin;
|
| - height += severe_->GetHeightForWidth(kRightColumnWidth);
|
| - height += kPanelVertMargin;
|
|
|
| - return gfx::Size(width, std::max(height,
|
| - static_cast<int>(Extension::EXTENSION_ICON_LARGE)));
|
| + return gfx::Size(width, std::max(height, kIconSize));
|
| }
|
|
|
| virtual void Layout() {
|
| @@ -137,9 +113,8 @@ class InstallDialogContent : public views::View, public views::DialogDelegate {
|
| int y = kPanelVertMargin;
|
|
|
| if (icon_) {
|
| - icon_->SetBounds(x, y, Extension::EXTENSION_ICON_LARGE,
|
| - Extension::EXTENSION_ICON_LARGE);
|
| - x += Extension::EXTENSION_ICON_LARGE;
|
| + icon_->SetBounds(x, y, kIconSize, kIconSize);
|
| + x += kIconSize;
|
| x += kPanelHorizMargin;
|
| }
|
|
|
| @@ -156,28 +131,21 @@ class InstallDialogContent : public views::View, public views::DialogDelegate {
|
| y += warning_->height();
|
|
|
| y += kPanelVertMargin;
|
| -
|
| - severe_->SizeToFit(kRightColumnWidth);
|
| - severe_->SetX(x);
|
| - severe_->SetY(y);
|
| - y += severe_->height();
|
| }
|
|
|
| ExtensionInstallUI::Delegate* delegate_;
|
| views::ImageView* icon_;
|
| views::Label* heading_;
|
| views::Label* warning_;
|
| - views::Label* severe_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(InstallDialogContent);
|
| };
|
|
|
| } // namespace
|
|
|
| -void ExtensionInstallUI::ShowExtensionInstallPrompt(Profile* profile,
|
| - Delegate* delegate,
|
| - Extension* extension,
|
| - SkBitmap* icon) {
|
| +void ExtensionInstallUI::ShowExtensionInstallPrompt(
|
| + Profile* profile, Delegate* delegate, Extension* extension, SkBitmap* icon,
|
| + const std::wstring& warning_text) {
|
| Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
|
| if (!browser) {
|
| delegate->ContinueInstall();
|
| @@ -191,5 +159,6 @@ void ExtensionInstallUI::ShowExtensionInstallPrompt(Profile* profile,
|
| }
|
|
|
| views::Window::CreateChromeWindow(window->GetNativeHandle(), gfx::Rect(),
|
| - new InstallDialogContent(delegate, extension, icon))->Show();
|
| + new InstallDialogContent(delegate, extension, icon,
|
| + warning_text))->Show();
|
| }
|
|
|