| 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/ui/views/about_chrome_view.h" | 5 #include "chrome/browser/ui/views/about_chrome_view.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <commdlg.h> | 8 #include <commdlg.h> |
| 9 #endif // defined(OS_WIN) | 9 #endif // defined(OS_WIN) |
| 10 | 10 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 void AboutChromeView::Init() { | 141 void AboutChromeView::Init() { |
| 142 text_direction_is_rtl_ = base::i18n::IsRTL(); | 142 text_direction_is_rtl_ = base::i18n::IsRTL(); |
| 143 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 143 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 144 | 144 |
| 145 // Views we will add to the *parent* of this dialog, since it will display | 145 // Views we will add to the *parent* of this dialog, since it will display |
| 146 // next to the buttons which we don't draw ourselves. | 146 // next to the buttons which we don't draw ourselves. |
| 147 throbber_.reset(new views::Throbber(50, true)); | 147 throbber_.reset(new views::Throbber(50, true)); |
| 148 throbber_->set_owned_by_client(); | 148 throbber_->set_owned_by_client(); |
| 149 throbber_->SetVisible(false); | 149 throbber_->SetVisible(false); |
| 150 | 150 |
| 151 SkBitmap* success_image = rb.GetBitmapNamed(IDR_UPDATE_UPTODATE); | 151 gfx::ImageSkia* success_image = rb.GetImageSkiaNamed(IDR_UPDATE_UPTODATE); |
| 152 success_indicator_.SetImage(*success_image); | 152 success_indicator_.SetImage(*success_image); |
| 153 success_indicator_.set_owned_by_client(); | 153 success_indicator_.set_owned_by_client(); |
| 154 | 154 |
| 155 SkBitmap* update_available_image = rb.GetBitmapNamed(IDR_UPDATE_AVAILABLE); | 155 gfx::ImageSkia* update_available_image = rb.GetImageSkiaNamed( |
| 156 IDR_UPDATE_AVAILABLE); |
| 156 update_available_indicator_.SetImage(*update_available_image); | 157 update_available_indicator_.SetImage(*update_available_image); |
| 157 update_available_indicator_.set_owned_by_client(); | 158 update_available_indicator_.set_owned_by_client(); |
| 158 | 159 |
| 159 SkBitmap* timeout_image = rb.GetBitmapNamed(IDR_UPDATE_FAIL); | 160 gfx::ImageSkia* timeout_image = rb.GetImageSkiaNamed(IDR_UPDATE_FAIL); |
| 160 timeout_indicator_.SetImage(*timeout_image); | 161 timeout_indicator_.SetImage(*timeout_image); |
| 161 timeout_indicator_.set_owned_by_client(); | 162 timeout_indicator_.set_owned_by_client(); |
| 162 | 163 |
| 163 update_label_.SetVisible(false); | 164 update_label_.SetVisible(false); |
| 164 update_label_.set_owned_by_client(); | 165 update_label_.set_owned_by_client(); |
| 165 | 166 |
| 166 // Regular view controls we draw by ourself. First, we add the background | 167 // Regular view controls we draw by ourself. First, we add the background |
| 167 // image for the dialog. We have two different background bitmaps, one for | 168 // image for the dialog. We have two different background images, one for |
| 168 // LTR UIs and one for RTL UIs. We load the correct bitmap based on the UI | 169 // LTR UIs and one for RTL UIs. We load the correct image based on the UI |
| 169 // layout of the view. | 170 // layout of the view. |
| 170 about_dlg_background_logo_ = new views::ImageView(); | 171 about_dlg_background_logo_ = new views::ImageView(); |
| 171 SkBitmap* about_background_logo = rb.GetBitmapNamed(base::i18n::IsRTL() ? | 172 gfx::ImageSkia* about_background_logo = rb.GetImageSkiaNamed( |
| 172 IDR_ABOUT_BACKGROUND_RTL : IDR_ABOUT_BACKGROUND); | 173 base::i18n::IsRTL() ? IDR_ABOUT_BACKGROUND_RTL : IDR_ABOUT_BACKGROUND); |
| 173 | 174 |
| 174 about_dlg_background_logo_->SetImage(*about_background_logo); | 175 about_dlg_background_logo_->SetImage(*about_background_logo); |
| 175 AddChildView(about_dlg_background_logo_); | 176 AddChildView(about_dlg_background_logo_); |
| 176 | 177 |
| 177 // Add the dialog labels. | 178 // Add the dialog labels. |
| 178 about_title_label_ = new views::Label( | 179 about_title_label_ = new views::Label( |
| 179 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 180 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 180 about_title_label_->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( | 181 about_title_label_->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( |
| 181 ui::ResourceBundle::BaseFont).DeriveFont(18)); | 182 ui::ResourceBundle::BaseFont).DeriveFont(18)); |
| 182 about_title_label_->SetBackgroundColor(SK_ColorWHITE); | 183 about_title_label_->SetBackgroundColor(SK_ColorWHITE); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 std::min(max_x - update_label_x, sz.width()), | 419 std::min(max_x - update_label_x, sz.width()), |
| 419 sz.height()); | 420 sz.height()); |
| 420 } | 421 } |
| 421 | 422 |
| 422 void AboutChromeView::OnPaint(gfx::Canvas* canvas) { | 423 void AboutChromeView::OnPaint(gfx::Canvas* canvas) { |
| 423 views::View::OnPaint(canvas); | 424 views::View::OnPaint(canvas); |
| 424 | 425 |
| 425 // Draw the background image color (and the separator) across the dialog. | 426 // Draw the background image color (and the separator) across the dialog. |
| 426 // This will become the background for the logo image at the top of the | 427 // This will become the background for the logo image at the top of the |
| 427 // dialog. | 428 // dialog. |
| 428 SkBitmap* background = ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( | 429 gfx::ImageSkia* background = ui::ResourceBundle::GetSharedInstance(). |
| 429 IDR_ABOUT_BACKGROUND_COLOR); | 430 GetImageSkiaNamed(IDR_ABOUT_BACKGROUND_COLOR); |
| 430 canvas->TileImageInt(*background, 0, 0, dialog_dimensions_.width(), | 431 canvas->TileImageInt(*background, 0, 0, dialog_dimensions_.width(), |
| 431 background->height()); | 432 background->height()); |
| 432 | 433 |
| 433 gfx::Font font = ui::ResourceBundle::GetSharedInstance().GetFont( | 434 gfx::Font font = ui::ResourceBundle::GetSharedInstance().GetFont( |
| 434 ui::ResourceBundle::BaseFont); | 435 ui::ResourceBundle::BaseFont); |
| 435 | 436 |
| 436 const gfx::Rect label_bounds = main_text_label_->bounds(); | 437 const gfx::Rect label_bounds = main_text_label_->bounds(); |
| 437 | 438 |
| 438 views::Link* link1 = | 439 views::Link* link1 = |
| 439 chromium_url_appears_first_ ? chromium_url_ : open_source_url_; | 440 chromium_url_appears_first_ ? chromium_url_ : open_source_url_; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 int height = error_label_->GetHeightForWidth( | 792 int height = error_label_->GetHeightForWidth( |
| 792 dialog_dimensions_.width() - (2 * views::kPanelHorizMargin)) + | 793 dialog_dimensions_.width() - (2 * views::kPanelHorizMargin)) + |
| 793 views::kRelatedControlVerticalSpacing; | 794 views::kRelatedControlVerticalSpacing; |
| 794 window_rect.set_height(window_rect.height() + height); | 795 window_rect.set_height(window_rect.height() + height); |
| 795 GetWidget()->SetBounds(window_rect); | 796 GetWidget()->SetBounds(window_rect); |
| 796 | 797 |
| 797 return height; | 798 return height; |
| 798 } | 799 } |
| 799 | 800 |
| 800 #endif | 801 #endif |
| OLD | NEW |