| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/outdated_upgrade_bubble_view.h" | 5 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "chrome/browser/upgrade_detector.h" | 8 #include "chrome/browser/upgrade_detector.h" |
| 9 #include "content/public/browser/page_navigator.h" | 9 #include "content/public/browser/page_navigator.h" |
| 10 #include "content/public/browser/user_metrics.h" | 10 #include "content/public/browser/user_metrics.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "grit/chromium_strings.h" | 12 #include "grit/chromium_strings.h" |
| 13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 14 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/views/controls/button/text_button.h" | 17 #include "ui/views/controls/button/label_button.h" |
| 18 #include "ui/views/controls/image_view.h" | 18 #include "ui/views/controls/image_view.h" |
| 19 #include "ui/views/controls/label.h" | 19 #include "ui/views/controls/label.h" |
| 20 #include "ui/views/layout/grid_layout.h" | 20 #include "ui/views/layout/grid_layout.h" |
| 21 #include "ui/views/layout/layout_constants.h" | 21 #include "ui/views/layout/layout_constants.h" |
| 22 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 23 | 23 |
| 24 using views::GridLayout; | 24 using views::GridLayout; |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Reset |upgrade_bubble_| here, not in destructor, because destruction is | 86 // Reset |upgrade_bubble_| here, not in destructor, because destruction is |
| 87 // asynchronous and ShowBubble may be called before full destruction and | 87 // asynchronous and ShowBubble may be called before full destruction and |
| 88 // would attempt to show a bubble that is closing. | 88 // would attempt to show a bubble that is closing. |
| 89 DCHECK_EQ(upgrade_bubble_, this); | 89 DCHECK_EQ(upgrade_bubble_, this); |
| 90 upgrade_bubble_ = NULL; | 90 upgrade_bubble_ = NULL; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void OutdatedUpgradeBubbleView::Init() { | 93 void OutdatedUpgradeBubbleView::Init() { |
| 94 string16 product_name(l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); | 94 string16 product_name(l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); |
| 95 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 95 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 96 reinstall_button_ = new views::NativeTextButton( | 96 reinstall_button_ = new views::LabelButton( |
| 97 this, l10n_util::GetStringFUTF16(IDS_REINSTALL_APP, product_name)); | 97 this, l10n_util::GetStringFUTF16(IDS_REINSTALL_APP, product_name)); |
| 98 reinstall_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); |
| 98 reinstall_button_->SetIsDefault(true); | 99 reinstall_button_->SetIsDefault(true); |
| 99 reinstall_button_->SetFont(rb.GetFont(ui::ResourceBundle::BoldFont)); | 100 reinstall_button_->SetFont(rb.GetFont(ui::ResourceBundle::BoldFont)); |
| 100 | 101 |
| 101 later_button_ = new views::NativeTextButton( | 102 later_button_ = new views::LabelButton( |
| 102 this, l10n_util::GetStringUTF16(IDS_LATER)); | 103 this, l10n_util::GetStringUTF16(IDS_LATER)); |
| 104 later_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); |
| 103 | 105 |
| 104 views::Label* title_label = new views::Label( | 106 views::Label* title_label = new views::Label( |
| 105 l10n_util::GetStringFUTF16(IDS_UPGRADE_BUBBLE_TITLE, product_name)); | 107 l10n_util::GetStringFUTF16(IDS_UPGRADE_BUBBLE_TITLE, product_name)); |
| 106 title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); | 108 title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); |
| 107 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 109 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 108 | 110 |
| 109 views::Label* text_label = new views::Label( | 111 views::Label* text_label = new views::Label( |
| 110 l10n_util::GetStringFUTF16(IDS_UPGRADE_BUBBLE_TEXT, product_name)); | 112 l10n_util::GetStringFUTF16(IDS_UPGRADE_BUBBLE_TEXT, product_name)); |
| 111 text_label->SetMultiLine(true); | 113 text_label->SetMultiLine(true); |
| 112 text_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 114 text_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 NEW_FOREGROUND_TAB, | 197 NEW_FOREGROUND_TAB, |
| 196 content::PAGE_TRANSITION_LINK, | 198 content::PAGE_TRANSITION_LINK, |
| 197 false)); | 199 false)); |
| 198 } else { | 200 } else { |
| 199 DCHECK_EQ(later_button_, sender); | 201 DCHECK_EQ(later_button_, sender); |
| 200 content::RecordAction( | 202 content::RecordAction( |
| 201 content::UserMetricsAction("OutdatedUpgradeBubble.Later")); | 203 content::UserMetricsAction("OutdatedUpgradeBubble.Later")); |
| 202 } | 204 } |
| 203 StartFade(false); | 205 StartFade(false); |
| 204 } | 206 } |
| OLD | NEW |