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/web_notification_tray.h" | 5 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/status_icons/status_icon.h" | 11 #include "chrome/browser/status_icons/status_icon.h" |
12 #include "chrome/browser/status_icons/status_tray.h" | 12 #include "chrome/browser/status_icons/status_tray.h" |
| 13 #include "content/public/browser/notification_service.h" |
13 #include "content/public/browser/user_metrics.h" | 14 #include "content/public/browser/user_metrics.h" |
14 #include "grit/chromium_strings.h" | 15 #include "grit/chromium_strings.h" |
15 #include "grit/theme_resources.h" | 16 #include "grit/theme_resources.h" |
16 #include "grit/ui_strings.h" | 17 #include "grit/ui_strings.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
20 #include "ui/gfx/image/image_skia_operations.h" | 21 #include "ui/gfx/image/image_skia_operations.h" |
21 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
22 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // Subtract the distance between mouse click point and the closest | 283 // Subtract the distance between mouse click point and the closest |
283 // (insetted) edge from the max height to show the message center within the | 284 // (insetted) edge from the max height to show the message center within the |
284 // (insetted) work area bounds. Also subtract the offset from the mouse | 285 // (insetted) work area bounds. Also subtract the offset from the mouse |
285 // click point we added earlier. | 286 // click point we added earlier. |
286 pos_info.max_height -= | 287 pos_info.max_height -= |
287 std::abs(mouse_click_point_.y() - corner.y()) + kMouseOffset; | 288 std::abs(mouse_click_point_.y() - corner.y()) + kMouseOffset; |
288 } | 289 } |
289 return pos_info; | 290 return pos_info; |
290 } | 291 } |
291 | 292 |
| 293 MessageCenterTray* WebNotificationTray::GetMessageCenterTray() { |
| 294 return message_center_tray_.get(); |
| 295 } |
| 296 |
292 void WebNotificationTray::CreateStatusIcon(const gfx::ImageSkia& image, | 297 void WebNotificationTray::CreateStatusIcon(const gfx::ImageSkia& image, |
293 const string16& tool_tip) { | 298 const string16& tool_tip) { |
294 if (status_icon_) | 299 if (status_icon_) |
295 return; | 300 return; |
296 | 301 |
297 StatusTray* status_tray = g_browser_process->status_tray(); | 302 StatusTray* status_tray = g_browser_process->status_tray(); |
298 if (!status_tray) | 303 if (!status_tray) |
299 return; | 304 return; |
300 | 305 |
301 status_icon_ = status_tray->CreateStatusIcon( | 306 status_icon_ = status_tray->CreateStatusIcon( |
(...skipping 20 matching lines...) Expand all Loading... |
322 DCHECK(status_icon); | 327 DCHECK(status_icon); |
323 status_icon->SetContextMenu(message_center_tray_->CreateQuietModeMenu()); | 328 status_icon->SetContextMenu(message_center_tray_->CreateQuietModeMenu()); |
324 } | 329 } |
325 | 330 |
326 MessageCenterWidgetDelegate* | 331 MessageCenterWidgetDelegate* |
327 WebNotificationTray::GetMessageCenterWidgetDelegateForTest() { | 332 WebNotificationTray::GetMessageCenterWidgetDelegateForTest() { |
328 return message_center_delegate_; | 333 return message_center_delegate_; |
329 } | 334 } |
330 | 335 |
331 } // namespace message_center | 336 } // namespace message_center |
OLD | NEW |