| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 [tray_controller_ close]; | 77 [tray_controller_ close]; |
| 78 tray_controller_.autorelease(); | 78 tray_controller_.autorelease(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool MessageCenterTrayBridge::ShowNotifierSettings() { | 81 bool MessageCenterTrayBridge::ShowNotifierSettings() { |
| 82 // This method needs to be implemented when the context menu of each | 82 // This method needs to be implemented when the context menu of each |
| 83 // notification is ready and it contains 'settings' menu item. | 83 // notification is ready and it contains 'settings' menu item. |
| 84 return false; | 84 return false; |
| 85 } | 85 } |
| 86 | 86 |
| 87 message_center::MessageCenterTray* |
| 88 MessageCenterTrayBridge::GetMessageCenterTray() { |
| 89 return tray_.get(); |
| 90 } |
| 91 |
| 87 void MessageCenterTrayBridge::UpdateStatusItem() { | 92 void MessageCenterTrayBridge::UpdateStatusItem() { |
| 88 // Only show the status item if there are notifications. | 93 // Only show the status item if there are notifications. |
| 89 if (message_center_->NotificationCount() == 0) { | 94 if (message_center_->NotificationCount() == 0) { |
| 90 [status_item_view_ removeItem]; | 95 [status_item_view_ removeItem]; |
| 91 status_item_view_.reset(); | 96 status_item_view_.reset(); |
| 92 return; | 97 return; |
| 93 } | 98 } |
| 94 | 99 |
| 95 if (!status_item_view_) { | 100 if (!status_item_view_) { |
| 96 status_item_view_.reset([[MCStatusItemView alloc] init]); | 101 status_item_view_.reset([[MCStatusItemView alloc] init]); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 119 | 124 |
| 120 UpdateStatusItem(); | 125 UpdateStatusItem(); |
| 121 | 126 |
| 122 [status_item_view_ setHighlight:YES]; | 127 [status_item_view_ setHighlight:YES]; |
| 123 NSRect frame = [[status_item_view_ window] frame]; | 128 NSRect frame = [[status_item_view_ window] frame]; |
| 124 [tray_controller_ showTrayAtRightOf:NSMakePoint(NSMinX(frame), | 129 [tray_controller_ showTrayAtRightOf:NSMakePoint(NSMinX(frame), |
| 125 NSMinY(frame)) | 130 NSMinY(frame)) |
| 126 atLeftOf:NSMakePoint(NSMaxX(frame), | 131 atLeftOf:NSMakePoint(NSMaxX(frame), |
| 127 NSMinY(frame))]; | 132 NSMinY(frame))]; |
| 128 } | 133 } |
| OLD | NEW |