OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/message_center/message_center_widget_delegate. h" | 5 #include "chrome/browser/ui/views/message_center/message_center_widget_delegate. h" |
6 | 6 |
7 #include <complex> | 7 #include <complex> |
8 | 8 |
9 #include "chrome/browser/ui/views/message_center/message_center_frame_view.h" | 9 #include "chrome/browser/ui/views/message_center/message_center_frame_view.h" |
10 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" | 10 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" |
11 #include "content/public/browser/user_metrics.h" | 11 #include "content/public/browser/user_metrics.h" |
12 #include "grit/chromium_strings.h" | |
13 #include "grit/generated_resources.h" | |
12 #include "ui/accessibility/ax_view_state.h" | 14 #include "ui/accessibility/ax_view_state.h" |
15 #include "ui/base/l10n/l10n_util.h" | |
13 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
14 #include "ui/message_center/message_center_style.h" | 17 #include "ui/message_center/message_center_style.h" |
15 #include "ui/message_center/views/message_center_view.h" | 18 #include "ui/message_center/views/message_center_view.h" |
16 #include "ui/native_theme/native_theme.h" | 19 #include "ui/native_theme/native_theme.h" |
17 #include "ui/views/border.h" | 20 #include "ui/views/border.h" |
18 #include "ui/views/layout/box_layout.h" | 21 #include "ui/views/layout/box_layout.h" |
19 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
20 | 23 |
21 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
22 #include "ui/views/win/hwnd_util.h" | 25 #include "ui/views/win/hwnd_util.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 widget->StackAtTop(); | 160 widget->StackAtTop(); |
158 widget->SetAlwaysOnTop(true); | 161 widget->SetAlwaysOnTop(true); |
159 | 162 |
160 const NotificationList::Notifications& notifications = | 163 const NotificationList::Notifications& notifications = |
161 tray_->message_center()->GetVisibleNotifications(); | 164 tray_->message_center()->GetVisibleNotifications(); |
162 SetNotifications(notifications); | 165 SetNotifications(notifications); |
163 | 166 |
164 widget->SetBounds(GetMessageCenterBounds()); | 167 widget->SetBounds(GetMessageCenterBounds()); |
165 widget->Show(); | 168 widget->Show(); |
166 widget->Activate(); | 169 widget->Activate(); |
170 | |
171 // set the label to "Chrome Notifications" or "Chromium Notifications". | |
172 base::string16 notification_title; | |
173 notification_title = l10n_util::GetStringFUTF16( | |
174 IDS_MESSAGE_CENTER_FOOTER_WITH_PRODUCT_TITLE, | |
175 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); | |
176 SetNotificationTitle(notification_title); | |
dewittj
2014/06/06 21:32:36
Let's put this part up into the constructor of Mes
Pete Williamson
2014/06/09 18:30:15
Done.
| |
167 } | 177 } |
168 | 178 |
169 gfx::Point MessageCenterWidgetDelegate::GetCorrectedAnchor( | 179 gfx::Point MessageCenterWidgetDelegate::GetCorrectedAnchor( |
170 gfx::Size calculated_size) { | 180 gfx::Size calculated_size) { |
171 gfx::Point corrected_anchor = pos_info_.inital_anchor_point; | 181 gfx::Point corrected_anchor = pos_info_.inital_anchor_point; |
172 | 182 |
173 // Inset the width slightly so that the click point is not exactly on the edge | 183 // Inset the width slightly so that the click point is not exactly on the edge |
174 // of the message center but somewhere within the middle 60 %. | 184 // of the message center but somewhere within the middle 60 %. |
175 int insetted_width = (calculated_size.width() * 4) / 5; | 185 int insetted_width = (calculated_size.width() * 4) / 5; |
176 | 186 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 bounds.set_y(corrected_anchor.y() - size.height()); | 245 bounds.set_y(corrected_anchor.y() - size.height()); |
236 if (pos_info_.message_center_alignment & ALIGNMENT_LEFT) | 246 if (pos_info_.message_center_alignment & ALIGNMENT_LEFT) |
237 bounds.set_x(corrected_anchor.x()); | 247 bounds.set_x(corrected_anchor.x()); |
238 if (pos_info_.message_center_alignment & ALIGNMENT_RIGHT) | 248 if (pos_info_.message_center_alignment & ALIGNMENT_RIGHT) |
239 bounds.set_x(corrected_anchor.x() - size.width()); | 249 bounds.set_x(corrected_anchor.x() - size.width()); |
240 | 250 |
241 return bounds; | 251 return bounds; |
242 } | 252 } |
243 | 253 |
244 } // namespace message_center | 254 } // namespace message_center |
OLD | NEW |