| 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/cocoa/notifications/message_center_tray_bridge.h" | 5 #include "chrome/browser/ui/cocoa/notifications/message_center_tray_bridge.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 bool MessageCenterTrayBridge::ShowPopups() { | 50 bool MessageCenterTrayBridge::ShowPopups() { |
| 51 popup_collection_.reset( | 51 popup_collection_.reset( |
| 52 [[MCPopupCollection alloc] initWithMessageCenter:message_center_]); | 52 [[MCPopupCollection alloc] initWithMessageCenter:message_center_]); |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void MessageCenterTrayBridge::HidePopups() { | 56 void MessageCenterTrayBridge::HidePopups() { |
| 57 popup_collection_.reset(); | 57 popup_collection_.reset(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void MessageCenterTrayBridge::UpdatePopups() { | |
| 61 // Nothing to do since the popup collection observes the MessageCenter | |
| 62 // directly. | |
| 63 } | |
| 64 | |
| 65 bool MessageCenterTrayBridge::ShowMessageCenter() { | 60 bool MessageCenterTrayBridge::ShowMessageCenter() { |
| 66 if (tray_controller_) | 61 if (tray_controller_) |
| 67 return false; | 62 return false; |
| 68 | 63 |
| 69 // Post a task to open the window, because in | 64 // Post a task to open the window, because in |
| 70 // MessageCenterTray::ShowMessageCenterBubble, the unread count gets set to | 65 // MessageCenterTray::ShowMessageCenterBubble, the unread count gets set to |
| 71 // 0 after it calls this delegate. In order show the window at the correct | 66 // 0 after it calls this delegate. In order show the window at the correct |
| 72 // position after the unread count is updated, opening the window must be | 67 // position after the unread count is updated, opening the window must be |
| 73 // performed after the return of this method. | 68 // performed after the return of this method. |
| 74 base::MessageLoop::current()->PostTask(FROM_HERE, | 69 base::MessageLoop::current()->PostTask(FROM_HERE, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 119 |
| 125 UpdateStatusItem(); | 120 UpdateStatusItem(); |
| 126 | 121 |
| 127 [status_item_view_ setHighlight:YES]; | 122 [status_item_view_ setHighlight:YES]; |
| 128 NSRect frame = [[status_item_view_ window] frame]; | 123 NSRect frame = [[status_item_view_ window] frame]; |
| 129 [tray_controller_ showTrayAtRightOf:NSMakePoint(NSMinX(frame), | 124 [tray_controller_ showTrayAtRightOf:NSMakePoint(NSMinX(frame), |
| 130 NSMinY(frame)) | 125 NSMinY(frame)) |
| 131 atLeftOf:NSMakePoint(NSMaxX(frame), | 126 atLeftOf:NSMakePoint(NSMaxX(frame), |
| 132 NSMinY(frame))]; | 127 NSMinY(frame))]; |
| 133 } | 128 } |
| OLD | NEW |