190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// found in the LICENSE file. 490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#ifndef UI_MESSAGE_CENTER_COCOA_TRAY_CONTROLLER_H_ 690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#define UI_MESSAGE_CENTER_COCOA_TRAY_CONTROLLER_H_ 790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#import <AppKit/AppKit.h> 990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "base/basictypes.h" 11eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/mac/scoped_nsobject.h" 1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "ui/message_center/message_center_export.h" 1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 1490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)@class MCTrayViewController; 1590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 1690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace message_center { 1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class MessageCenterTray; 1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 2090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// The window controller for the message center tray. This merely hosts the 2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// view from MCTrayViewController. 2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)MESSAGE_CENTER_EXPORT 2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)@interface MCTrayController : NSWindowController<NSWindowDelegate> { 2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) @private 2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) message_center::MessageCenterTray* tray_; // Weak, indirectly owns this. 2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 2790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // View controller that provides this window's content. 28eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch base::scoped_nsobject<MCTrayViewController> viewController_; 29eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 30eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // An event monitor that listens for clicks outside the tray window to cause 31eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // it to close. 32eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch id clickEventMonitor_; 3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 35a031efa9dbd9b321781674193e8ac7636d47eb1dBen Murdoch@property(readonly, nonatomic) MCTrayViewController* viewController; 36a031efa9dbd9b321781674193e8ac7636d47eb1dBen Murdoch 3790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Designated initializer. 3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)- (id)initWithMessageCenterTray:(message_center::MessageCenterTray*)tray; 3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Opens the message center tray to either the right or left of the given 41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// points, depending on if it will fit on screen. It will try opening to the 42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// right first, but if the window does not fit on screen, it will open to the 43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// left. 44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)- (void)showTrayAtRightOf:(NSPoint)rightPoint atLeftOf:(NSPoint)leftPoint; 4590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 4690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Callback from MessageCenterTrayDelegate, used to update the tray content. 4790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)- (void)onMessageCenterTrayChanged; 4890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 4990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)@end 5090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 5190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#endif // UI_MESSAGE_CENTER_COCOA_TRAY_CONTROLLER_H_ 52