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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
8 #include "chrome/browser/notifications/balloon_collection_impl.h" | 8 #include "chrome/browser/notifications/balloon_collection_impl.h" |
9 #include "chrome/browser/notifications/desktop_notification_service.h" | 9 #include "chrome/browser/notifications/desktop_notification_service.h" |
10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 params, 0, 0, DesktopNotificationService::PageNotification)); | 81 params, 0, 0, DesktopNotificationService::PageNotification)); |
82 MessageLoopForUI::current()->RunAllPending(); | 82 MessageLoopForUI::current()->RunAllPending(); |
83 return balloons().front(); | 83 return balloons().front(); |
84 } | 84 } |
85 | 85 |
86 static int GetBalloonBottomPosition(Balloon* balloon) { | 86 static int GetBalloonBottomPosition(Balloon* balloon) { |
87 #if defined(OS_MACOSX) | 87 #if defined(OS_MACOSX) |
88 // The position returned by the notification balloon is based on Mac's | 88 // The position returned by the notification balloon is based on Mac's |
89 // vertically inverted orientation. We need to flip it so that it can | 89 // vertically inverted orientation. We need to flip it so that it can |
90 // be compared against the position returned by the panel. | 90 // be compared against the position returned by the panel. |
91 gfx::Size screen_size = gfx::Screen::GetPrimaryMonitor().size(); | 91 gfx::Size screen_size = gfx::Screen::GetPrimaryDisplay().size(); |
92 return screen_size.height() - balloon->GetPosition().y(); | 92 return screen_size.height() - balloon->GetPosition().y(); |
93 #else | 93 #else |
94 return balloon->GetPosition().y() + balloon->GetViewSize().height(); | 94 return balloon->GetPosition().y() + balloon->GetViewSize().height(); |
95 #endif | 95 #endif |
96 } | 96 } |
97 | 97 |
98 static void DragPanelToMouseLocation(Panel* panel, | 98 static void DragPanelToMouseLocation(Panel* panel, |
99 const gfx::Point& new_mouse_location) { | 99 const gfx::Point& new_mouse_location) { |
100 PanelManager* panel_manager = PanelManager::GetInstance(); | 100 PanelManager* panel_manager = PanelManager::GetInstance(); |
101 panel_manager->StartDragging(panel, panel->GetBounds().origin()); | 101 panel_manager->StartDragging(panel, panel->GetBounds().origin()); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 GetBalloonBottomPosition(balloon)); | 405 GetBalloonBottomPosition(balloon)); |
406 | 406 |
407 // Close short panel. Expect that the notification balloo moves back to its | 407 // Close short panel. Expect that the notification balloo moves back to its |
408 // original position. | 408 // original position. |
409 short_panel->Close(); | 409 short_panel->Close(); |
410 MessageLoopForUI::current()->RunAllPending(); | 410 MessageLoopForUI::current()->RunAllPending(); |
411 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 411 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
412 } | 412 } |
413 | 413 |
414 #endif // OS_MACOSX | 414 #endif // OS_MACOSX |
OLD | NEW |