diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-27 06:47:46 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-27 06:47:46 +0000 |
commit | b24d831bff725a59e472f0aaa4547dfb31344490 (patch) | |
tree | 90d92f9fb363696c1dbd37b297068624ed4af6ea /chrome/browser/views | |
parent | a0a04ee4b35d3abb9b4d0bf093fcaead55821473 (diff) | |
download | chromium_src-b24d831bff725a59e472f0aaa4547dfb31344490.zip chromium_src-b24d831bff725a59e472f0aaa4547dfb31344490.tar.gz chromium_src-b24d831bff725a59e472f0aaa4547dfb31344490.tar.bz2 |
Update of the extension install UI:
- Give the user more information about which hosts an
extension can access.
- Remove the red severe warning because it doesn't play well
with themes and because it adds nothing when the other
text is more specific.
- Make the image a bit smaller.
Also integrate this new idea with the silent/not-silent update flow.
BUG=12129,12140,19582
Review URL: http://codereview.chromium.org/173463
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/extensions/extension_install_prompt.cc | 61 |
1 files changed, 15 insertions, 46 deletions
diff --git a/chrome/browser/views/extensions/extension_install_prompt.cc b/chrome/browser/views/extensions/extension_install_prompt.cc index 6c58914..cc7d41c 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(); } |