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_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/ui/layout_constants.h" | 10 #include "chrome/browser/ui/layout_constants.h" |
11 #include "chrome/browser/ui/views/elevation_icon_setter.h" | 11 #include "chrome/browser/ui/views/elevation_icon_setter.h" |
12 #include "chrome/browser/upgrade_detector.h" | 12 #include "chrome/browser/upgrade_detector.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
16 #include "chrome/grit/theme_resources.h" | |
17 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
18 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/page_navigator.h" | 18 #include "content/public/browser/page_navigator.h" |
20 #include "content/public/browser/user_metrics.h" | 19 #include "content/public/browser/user_metrics.h" |
21 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/base/resource/resource_bundle.h" | |
23 #include "ui/views/controls/label.h" | 21 #include "ui/views/controls/label.h" |
24 #include "ui/views/layout/fill_layout.h" | 22 #include "ui/views/layout/fill_layout.h" |
25 #include "ui/views/layout/layout_constants.h" | 23 #include "ui/views/layout/layout_constants.h" |
26 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
27 #include "url/gurl.h" | 25 #include "url/gurl.h" |
28 | 26 |
29 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
30 #include "chrome/installer/util/google_update_util.h" | 28 #include "chrome/installer/util/google_update_util.h" |
31 #endif | 29 #endif |
32 | 30 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // asynchronous and ShowBubble may be called before full destruction and | 91 // asynchronous and ShowBubble may be called before full destruction and |
94 // would attempt to show a bubble that is closing. | 92 // would attempt to show a bubble that is closing. |
95 DCHECK_EQ(g_upgrade_bubble, this); | 93 DCHECK_EQ(g_upgrade_bubble, this); |
96 g_upgrade_bubble = nullptr; | 94 g_upgrade_bubble = nullptr; |
97 } | 95 } |
98 | 96 |
99 base::string16 OutdatedUpgradeBubbleView::GetWindowTitle() const { | 97 base::string16 OutdatedUpgradeBubbleView::GetWindowTitle() const { |
100 return l10n_util::GetStringUTF16(IDS_UPGRADE_BUBBLE_TITLE); | 98 return l10n_util::GetStringUTF16(IDS_UPGRADE_BUBBLE_TITLE); |
101 } | 99 } |
102 | 100 |
103 gfx::ImageSkia OutdatedUpgradeBubbleView::GetWindowIcon() { | |
104 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | |
105 IDR_UPDATE_MENU_SEVERITY_HIGH); | |
106 } | |
107 | |
108 bool OutdatedUpgradeBubbleView::ShouldShowWindowIcon() const { | |
109 return true; | |
110 } | |
111 | |
112 bool OutdatedUpgradeBubbleView::Cancel() { | 101 bool OutdatedUpgradeBubbleView::Cancel() { |
113 content::RecordAction(base::UserMetricsAction("OutdatedUpgradeBubble.Later")); | 102 content::RecordAction(base::UserMetricsAction("OutdatedUpgradeBubble.Later")); |
114 return true; | 103 return true; |
115 } | 104 } |
116 | 105 |
117 bool OutdatedUpgradeBubbleView::Accept() { | 106 bool OutdatedUpgradeBubbleView::Accept() { |
118 // Offset the +1 in the dtor. | 107 // Offset the +1 in the dtor. |
119 --g_num_ignored_bubbles; | 108 --g_num_ignored_bubbles; |
120 | 109 |
121 if (auto_update_enabled_) { | 110 if (auto_update_enabled_) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 views::View* anchor_view, | 175 views::View* anchor_view, |
187 content::PageNavigator* navigator, | 176 content::PageNavigator* navigator, |
188 bool auto_update_enabled) | 177 bool auto_update_enabled) |
189 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), | 178 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
190 auto_update_enabled_(auto_update_enabled), | 179 auto_update_enabled_(auto_update_enabled), |
191 navigator_(navigator) { | 180 navigator_(navigator) { |
192 // Compensate for built-in vertical padding in the anchor view's image. | 181 // Compensate for built-in vertical padding in the anchor view's image. |
193 set_anchor_view_insets(gfx::Insets( | 182 set_anchor_view_insets(gfx::Insets( |
194 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); | 183 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); |
195 } | 184 } |
OLD | NEW |