0

Mac/clang: Uncontentious fixes.

* Remove unused variables
* Make types in h and cc files agree
* Use subclasses if we call subclass methods
* Fix one real bug (`if (a); a->foo()`)
* Fix forward declarations to be correct
* Don't mark some definitions with "extern"

Review URL: http://codereview.chromium.org/2730015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49570 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
thakis@chromium.org
2010-06-11 19:19:37 +00:00
parent 9631292a32
commit 227fceeec5
23 changed files with 28 additions and 44 deletions

@ -31,7 +31,7 @@ SignatureCreator* SignatureCreator::Create(RSAPrivateKey* key) {
crtn = CSSM_SignDataInit(result->sig_handle_);
if (crtn) {
NOTREACHED();
return false;
return NULL;
}
return result.release();

@ -988,7 +988,7 @@ void RecordLastRunAppBundlePath() {
[self commandDispatch:sender];
}
- (NSMenu*)applicationDockMenu:(id)sender {
- (NSMenu*)applicationDockMenu:(NSApplication*)sender {
NSMenu* dockMenu = [[[NSMenu alloc] initWithTitle: @""] autorelease];
NSString* titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_WINDOW_MAC);
scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc]

@ -167,8 +167,7 @@ OSStatus ExecuteWithPrivilegesAndWait(AuthorizationRef authorization,
}
if (pid != -1) {
pid_t wait_result;
HANDLE_EINTR(wait_result = waitpid(pid, exit_status_pointer, 0));
pid_t wait_result = HANDLE_EINTR(waitpid(pid, exit_status_pointer, 0));
if (wait_result != pid) {
PLOG(ERROR) << "waitpid";
*exit_status_pointer = -1;

@ -367,7 +367,6 @@ const CGFloat kScrollWindowVerticalMargin = 0.0;
// Create buttons for all our nodes.
// TODO(jrg): break up into more and smaller routines for easier unit testing.
- (void)configureWindow {
NSPoint newWindowTopLeft = [self windowTopLeft];
const BookmarkNode* node = [parentButton_ bookmarkNode];
DCHECK(node);
int startingIndex = [[parentButton_ cell] startingChildIndex];

@ -9,7 +9,7 @@
@class BookmarkBarFolderController;
@class BookmarkButton;
class BookmarkDragData;
struct BookmarkDragData;
class BookmarkModel;
class BookmarkNode;
@class BrowserWindowController;

@ -20,8 +20,6 @@
@interface BookmarkEditorBaseController ()
@property (retain, readwrite) NSArray* folderTreeArray;
// Return the folder tree object for the given path.
- (BookmarkFolderInfo*)folderForIndexPath:(NSIndexPath*)path;

@ -1473,14 +1473,15 @@
- (void)swipeWithEvent:(NSEvent*)event {
// Map forwards and backwards to history; left is positive, right is negative.
unsigned int command = 0;
if ([event deltaX] > 0.5)
if ([event deltaX] > 0.5) {
command = IDC_BACK;
else if ([event deltaX] < -0.5)
} else if ([event deltaX] < -0.5) {
command = IDC_FORWARD;
else if ([event deltaY] > 0.5)
; // TODO(pinkerton): figure out page-up, http://crbug.com/16305
else if ([event deltaY] < -0.5)
; // TODO(pinkerton): figure out page-down, http://crbug.com/16305
} else if ([event deltaY] > 0.5) {
// TODO(pinkerton): figure out page-up, http://crbug.com/16305
} else if ([event deltaY] < -0.5) {
// TODO(pinkerton): figure out page-down, http://crbug.com/16305
}
// Ensure the command is valid first (ExecuteCommand() won't do that) and
// then make it so.

@ -120,7 +120,6 @@ static const CGFloat kExtraMarginForDetailsView = 10;
[detailsViewController_ setContentObject:selectionAdapterObject_.get()];
NSRect viewFrameRect = [disclosedViewPlaceholder_ frame];
[[disclosedViewPlaceholder_ superview]
replaceSubview:disclosedViewPlaceholder_
with:[detailsViewController_ view]];

@ -22,7 +22,7 @@ class Profile;
@interface CustomHomePagesModel : NSObject {
@private
scoped_nsobject<NSArray> entries_;
scoped_nsobject<NSMutableArray> entries_;
Profile* profile_; // weak, used for loading favicons
}

@ -97,7 +97,6 @@ private:
tabContents->GetContainerBounds(&bounds);
imageWidth_ = CGImageGetWidth(image);
CGFloat imageHeight = CGImageGetHeight(image);
CGRect imageBounds = CGRectMake(0, 0, imageWidth_, imageHeight);
// Sanity check the size in case there's no room to display the animation.
if (bounds.height() < imageHeight) {

@ -40,7 +40,7 @@ extern const CGFloat kBrowserActionWidth;
scoped_nsobject<NSImage> tabSpecificIcon_;
// Used to move the button and query whether a button is currently animating.
scoped_nsobject<NSAnimation> moveAnimation_;
scoped_nsobject<NSViewAnimation> moveAnimation_;
// The extension for this button. Weak.
Extension* extension_;

@ -42,7 +42,7 @@ static const CGFloat kBrowserActionOriginYOffset = 5;
// The size of each button on the toolbar.
static const CGFloat kBrowserActionHeight = 27;
extern const CGFloat kBrowserActionWidth = 29;
const CGFloat kBrowserActionWidth = 29;
namespace {
const CGFloat kAnimationDuration = 0.2;
@ -181,8 +181,6 @@ class ExtensionImageTrackerBridge : public NotificationObserver,
[[self superview] addSubview:self positioned:NSWindowAbove relativeTo:nil];
}
isBeingDragged_ = YES;
NSPoint location = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
NSRect buttonFrame = [self frame];
// TODO(andybons): Constrain the buttons to be within the container.
// Clamp the button to be within its superview along the X-axis.

@ -55,7 +55,7 @@ extern const NSString* kBrowserActionVisibilityChangedNotification;
scoped_nsobject<NSMutableArray> hiddenButtons_;
// The currently running chevron animation (fade in/out).
scoped_nsobject<NSAnimation> chevronAnimation_;
scoped_nsobject<NSViewAnimation> chevronAnimation_;
// The chevron button used when Browser Actions are hidden.
scoped_nsobject<MenuButton> chevronMenuButton_;

@ -28,7 +28,7 @@
#include "grit/theme_resources.h"
#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
extern const CGFloat kBrowserActionButtonPadding = 3;
const CGFloat kBrowserActionButtonPadding = 3;
extern const NSString* kBrowserActionVisibilityChangedNotification =
@"BrowserActionVisibilityChangedNotification";

@ -141,7 +141,7 @@
static_cast<menus::MenuModel*>(
[[sender representedObject] pointerValue]);
DCHECK(model);
if (model);
if (model)
model->ActivatedAt(modelIndex);
}

@ -935,7 +935,7 @@ class PrefObserverBridge : public NotificationObserver,
}
// Getter for the |customPagesSource| property for bindings.
- (id)customPagesSource {
- (CustomHomePagesModel*)customPagesSource {
return customPagesSource_.get();
}

@ -29,7 +29,7 @@ class SelectFileDialogImpl;
}
- (id)initWithSelectFileDialogImpl:(SelectFileDialogImpl*)s;
- (void)endedPanel:(NSSavePanel *)panel
- (void)endedPanel:(NSSavePanel*)panel
withReturn:(int)returnCode
context:(void *)context;
@ -325,7 +325,7 @@ bool SelectFileDialogImpl::ShouldEnableFilename(NSPanel* dialog,
return self;
}
- (void)endedPanel:(id)panel
- (void)endedPanel:(NSSavePanel*)panel
withReturn:(int)returnCode
context:(void *)context {
int index = 0;
@ -355,7 +355,8 @@ bool SelectFileDialogImpl::ShouldEnableFilename(NSPanel* dialog,
index = 1;
}
} else {
NSArray* filenames = [panel filenames];
CHECK([panel isKindOfClass:[NSOpenPanel class]]);
NSArray* filenames = [static_cast<NSOpenPanel*>(panel) filenames];
for (NSString* filename in filenames)
paths.push_back(FilePath(base::SysNSStringToUTF8(filename)));
}

@ -284,8 +284,6 @@ const CGFloat kRapidCloseDist = 2.5;
[NSApp nextEventMatchingMask:NSLeftMouseUpMask | NSLeftMouseDraggedMask
untilDate:[NSDate distantFuture]
inMode:NSDefaultRunLoopMode dequeue:YES];
NSPoint thisPoint = [NSEvent mouseLocation];
NSEventType type = [theEvent type];
if (type == NSLeftMouseDragged) {
[self mouseDragged:theEvent];
@ -339,7 +337,6 @@ const CGFloat kRapidCloseDist = 2.5;
tabWasDragged_ = YES;
if (draggingWithinTabStrip_) {
NSRect frame = [self frame];
NSPoint thisPoint = [NSEvent mouseLocation];
CGFloat stretchiness = thisPoint.y - dragOrigin_.y;
stretchiness = copysign(sqrtf(fabs(stretchiness))/sqrtf(kTearDistance),
@ -366,9 +363,6 @@ const CGFloat kRapidCloseDist = 2.5;
}
}
NSPoint lastPoint =
[[theEvent window] convertBaseToScreen:[theEvent locationInWindow]];
// Do not start dragging until the user has "torn" the tab off by
// moving more than 3 pixels.
NSDate* targetDwellDate = nil; // The date this target was first chosen.
@ -502,7 +496,6 @@ const CGFloat kRapidCloseDist = 2.5;
// Compute where placeholder should go and insert it into the
// destination tab strip.
NSRect dropTabFrame = [[targetController_ tabStripView] frame];
TabView* draggedTabView = (TabView*)[draggedController_ selectedTabView];
NSRect tabFrame = [draggedTabView frame];
tabFrame.origin = [dragWindow_ convertBaseToScreen:tabFrame.origin];
@ -510,9 +503,6 @@ const CGFloat kRapidCloseDist = 2.5;
convertScreenToBase:tabFrame.origin];
tabFrame = [[targetController_ tabStripView]
convertRect:tabFrame fromView:nil];
NSPoint point =
[sourceWindow_ convertBaseToScreen:
[draggedTabView convertPoint:NSZeroPoint toView:nil]];
[targetController_ insertPlaceholderForTab:self
frame:tabFrame
yStretchiness:0];

@ -19,7 +19,7 @@
@implementation URLDropTargetHandler
- (id)initWithView:(NSView*)view {
- (id)initWithView:(NSView<URLDropTarget>*)view {
if ((self = [super init])) {
view_ = view;
[view_ registerForDraggedTypes:

@ -10,8 +10,8 @@
#include "base/scoped_ptr.h"
#include "googleurl/src/gurl.h"
struct WebDropData;
@class TabContentsViewCocoa;
struct WebDropData;
// A class that handles tracking and event processing for a drag and drop
// originating from the content area.

@ -9,7 +9,7 @@
class GURL;
class RenderViewHost;
class TabContents;
class WebDropData;
struct WebDropData;
// A typedef for a RenderViewHost used for comparison purposes only.
typedef RenderViewHost* RenderViewHostIdentifier;

@ -212,7 +212,7 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
void KillSelf();
void set_parent_view(BaseView* parent_view) { parent_view_ = parent_view; }
void set_parent_view(NSView* parent_view) { parent_view_ = parent_view; }
// These member variables should be private, but the associated ObjC class
// needs access to them and can't be made a friend.
@ -280,7 +280,7 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
ScopedRunnableMethodFactory<RenderWidgetHostViewMac> shutdown_factory_;
// Used for positioning a popup menu.
BaseView* parent_view_;
NSView* parent_view_;
// Helper class for managing instances of accelerated plug-ins.
AcceleratedSurfaceContainerManagerMac plugin_container_manager_;

@ -9,11 +9,11 @@
#include "third_party/skia/include/core/SkColor.h"
struct SkMatrix;
struct SkIRect;
struct SkPoint;
struct SkRect;
class SkBitmap;
class SkMatrix;
#ifdef __LP64__
typedef CGSize NSSize;
#else