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

Side by Side Diff: chrome/browser/ui/cocoa/app_menu/app_menu_controller.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: Rebase Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/app_menu/app_menu_controller.h" 5 #import "chrome/browser/ui/cocoa/app_menu/app_menu_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/mac/bundle_locations.h" 10 #include "base/mac/bundle_locations.h"
11 #include "base/mac/objc_release_properties.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
14 #include "base/metrics/user_metrics.h" 15 #include "base/metrics/user_metrics.h"
15 #include "base/scoped_observer.h" 16 #include "base/scoped_observer.h"
16 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
17 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
18 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
19 #include "chrome/app/chrome_command_ids.h" 20 #include "chrome/app/chrome_command_ids.h"
20 #import "chrome/browser/app_controller_mac.h" 21 #import "chrome/browser/app_controller_mac.h"
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 @synthesize zoomPlus = zoomPlus_; 595 @synthesize zoomPlus = zoomPlus_;
595 @synthesize zoomDisplay = zoomDisplay_; 596 @synthesize zoomDisplay = zoomDisplay_;
596 @synthesize zoomMinus = zoomMinus_; 597 @synthesize zoomMinus = zoomMinus_;
597 @synthesize zoomFullScreen = zoomFullScreen_; 598 @synthesize zoomFullScreen = zoomFullScreen_;
598 @synthesize toolbarActionsOverflowItem = toolbarActionsOverflowItem_; 599 @synthesize toolbarActionsOverflowItem = toolbarActionsOverflowItem_;
599 @synthesize overflowActionsContainerView = overflowActionsContainerView_; 600 @synthesize overflowActionsContainerView = overflowActionsContainerView_;
600 601
601 - (id)initWithController:(AppMenuController*)controller { 602 - (id)initWithController:(AppMenuController*)controller {
602 if ((self = [super initWithNibName:@"AppMenu" 603 if ((self = [super initWithNibName:@"AppMenu"
603 bundle:base::mac::FrameworkBundle()])) { 604 bundle:base::mac::FrameworkBundle()])) {
604 propertyReleaser_.Init(self, [AppMenuButtonViewController class]);
605 controller_ = controller; 605 controller_ = controller;
606 [[NSNotificationCenter defaultCenter] 606 [[NSNotificationCenter defaultCenter]
607 addObserver:self 607 addObserver:self
608 selector:@selector(containerSuperviewFrameChanged:) 608 selector:@selector(containerSuperviewFrameChanged:)
609 name:NSViewFrameDidChangeNotification 609 name:NSViewFrameDidChangeNotification
610 object:[overflowActionsContainerView_ superview]]; 610 object:[overflowActionsContainerView_ superview]];
611 } 611 }
612 return self; 612 return self;
613 } 613 }
614 614
615 - (void)dealloc { 615 - (void)dealloc {
616 [[NSNotificationCenter defaultCenter] removeObserver:self]; 616 [[NSNotificationCenter defaultCenter] removeObserver:self];
617 base::mac::ReleaseProperties(self);
617 [super dealloc]; 618 [super dealloc];
618 } 619 }
619 620
620 - (IBAction)dispatchAppMenuCommand:(id)sender { 621 - (IBAction)dispatchAppMenuCommand:(id)sender {
621 [controller_ dispatchAppMenuCommand:sender]; 622 [controller_ dispatchAppMenuCommand:sender];
622 } 623 }
623 624
624 - (void)containerSuperviewFrameChanged:(NSNotification*)notification { 625 - (void)containerSuperviewFrameChanged:(NSNotification*)notification {
625 // AppKit menus were probably never designed with a view like the browser 626 // AppKit menus were probably never designed with a view like the browser
626 // actions container in mind, and, as a result, we come across a few oddities. 627 // actions container in mind, and, as a result, we come across a few oddities.
627 // One of these is that the container's superview will, on some versions of 628 // One of these is that the container's superview will, on some versions of
628 // OSX, change frame position sometime after the the menu begins tracking 629 // OSX, change frame position sometime after the the menu begins tracking
629 // (and thus, after all our ability to adjust it normally). Throw in the 630 // (and thus, after all our ability to adjust it normally). Throw in the
630 // towel, and simply don't let the frame move from where it's supposed to be. 631 // towel, and simply don't let the frame move from where it's supposed to be.
631 // TODO(devlin): Yet another Cocoa hack. It'd be good to find a workaround, 632 // TODO(devlin): Yet another Cocoa hack. It'd be good to find a workaround,
632 // but unlikely unless we replace the Cocoa menu implementation. 633 // but unlikely unless we replace the Cocoa menu implementation.
633 NSView* containerSuperview = [overflowActionsContainerView_ superview]; 634 NSView* containerSuperview = [overflowActionsContainerView_ superview];
634 if (NSMinX([containerSuperview frame]) != 0) 635 if (NSMinX([containerSuperview frame]) != 0)
635 [containerSuperview setFrameOrigin:NSZeroPoint]; 636 [containerSuperview setFrameOrigin:NSZeroPoint];
636 } 637 }
637 638
638 @end // @implementation AppMenuButtonViewController 639 @end // @implementation AppMenuButtonViewController
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/app_menu/app_menu_controller.h ('k') | chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698