Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Unified Diff: ui/message_center/cocoa/tray_controller.mm

Issue 1334363002: [Eraser] First pass at removing the notification center panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: peter comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/message_center/cocoa/tray_controller.h ('k') | ui/message_center/cocoa/tray_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/cocoa/tray_controller.mm
diff --git a/ui/message_center/cocoa/tray_controller.mm b/ui/message_center/cocoa/tray_controller.mm
deleted file mode 100644
index ddbdcc77cdc63bf57badbef9480cd150c539271a..0000000000000000000000000000000000000000
--- a/ui/message_center/cocoa/tray_controller.mm
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/message_center/cocoa/tray_controller.h"
-
-#include "ui/base/cocoa/window_size_constants.h"
-#include "ui/base/resource/resource_bundle.h"
-#import "ui/message_center/cocoa/popup_collection.h"
-#import "ui/message_center/cocoa/tray_view_controller.h"
-#include "ui/message_center/message_center_tray.h"
-#include "ui/message_center/message_center_tray_delegate.h"
-
-@interface MCTrayWindow : NSPanel
-@end
-
-@implementation MCTrayWindow
-
-- (BOOL)canBecomeKeyWindow {
- return YES;
-}
-
-- (void)cancelOperation:(id)sender {
- [self orderOut:self];
-}
-
-@end
-
-@implementation MCTrayController
-
-- (id)initWithMessageCenterTray:(message_center::MessageCenterTray*)tray {
- base::scoped_nsobject<MCTrayWindow> window(
- [[MCTrayWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater
- styleMask:NSBorderlessWindowMask |
- NSNonactivatingPanelMask
- backing:NSBackingStoreBuffered
- defer:NO]);
- if ((self = [super initWithWindow:window])) {
- tray_ = tray;
-
- [window setDelegate:self];
- [window setHasShadow:YES];
- [window setHidesOnDeactivate:NO];
- [window setLevel:NSFloatingWindowLevel];
-
- viewController_.reset([[MCTrayViewController alloc] initWithMessageCenter:
- tray_->message_center()]);
- NSView* contentView = [viewController_ view];
- [window setFrame:[contentView frame] display:NO];
- [window setContentView:contentView];
-
- // The global event monitor will close the tray in response to events
- // delivered to other applications, and -windowDidResignKey: will catch
- // events within the application.
- __block MCTrayController* weakSelf = self;
- clickEventMonitor_ =
- [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask |
- NSRightMouseDownMask |
- NSOtherMouseDownMask
- handler:^(NSEvent* event) {
- [weakSelf windowDidResignKey:nil];
- }];
- }
- return self;
-}
-
-- (void)dealloc {
- [NSEvent removeMonitor:clickEventMonitor_];
- [super dealloc];
-}
-
-- (MCTrayViewController*)viewController {
- return viewController_.get();
-}
-
-- (void)close {
- [viewController_ onWindowClosing];
- [super close];
-}
-
-- (void)showTrayAtRightOf:(NSPoint)rightPoint atLeftOf:(NSPoint)leftPoint {
- NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
- NSRect screenFrame = [screen visibleFrame];
-
- NSRect frame = [[viewController_ view] frame];
-
- if (rightPoint.x + NSWidth(frame) < NSMaxX(screenFrame)) {
- frame.origin.x = rightPoint.x;
- frame.origin.y = rightPoint.y - NSHeight(frame);
- } else {
- frame.origin.x = leftPoint.x - NSWidth(frame);
- frame.origin.y = leftPoint.y - NSHeight(frame);
- }
-
- [[self window] setFrame:frame display:YES];
- [viewController_ scrollToTop];
- [self showWindow:nil];
-}
-
-- (void)onMessageCenterTrayChanged {
- [viewController_ onMessageCenterTrayChanged];
-}
-
-- (void)windowDidResignKey:(NSNotification*)notification {
- // The settings bubble data structures assume that the settings dialog is
- // visible only for short periods of time: There's a fixed list of permissions
- // for example.
- [viewController_ cleanupSettings];
-
- tray_->HideMessageCenterBubble();
-}
-
-@end
« no previous file with comments | « ui/message_center/cocoa/tray_controller.h ('k') | ui/message_center/cocoa/tray_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698