diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-11 19:19:37 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-11 19:19:37 +0000 |
commit | 227fceeec5b6f83446fa059b700b045f0fc2efd0 (patch) | |
tree | 5f07e0efc03308206116a2e8cb9bcacece72f458 | |
parent | 9631292a32990316f2c950d7e727afda68f7c3b5 (diff) | |
download | chromium_src-227fceeec5b6f83446fa059b700b045f0fc2efd0.zip chromium_src-227fceeec5b6f83446fa059b700b045f0fc2efd0.tar.gz chromium_src-227fceeec5b6f83446fa059b700b045f0fc2efd0.tar.bz2 |
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
23 files changed, 28 insertions, 44 deletions
diff --git a/base/crypto/signature_creator_mac.cc b/base/crypto/signature_creator_mac.cc index f96b1d4..d10d54c 100644 --- a/base/crypto/signature_creator_mac.cc +++ b/base/crypto/signature_creator_mac.cc @@ -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(); diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 4fa46b6..b44398a 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -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] diff --git a/chrome/browser/cocoa/authorization_util.mm b/chrome/browser/cocoa/authorization_util.mm index 709fcc1..a879db2 100644 --- a/chrome/browser/cocoa/authorization_util.mm +++ b/chrome/browser/cocoa/authorization_util.mm @@ -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; diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller.mm b/chrome/browser/cocoa/bookmark_bar_folder_controller.mm index a8f696e..752ab4b 100644 --- a/chrome/browser/cocoa/bookmark_bar_folder_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_folder_controller.mm @@ -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]; diff --git a/chrome/browser/cocoa/bookmark_button.h b/chrome/browser/cocoa/bookmark_button.h index a40f23c..745d141 100644 --- a/chrome/browser/cocoa/bookmark_button.h +++ b/chrome/browser/cocoa/bookmark_button.h @@ -9,7 +9,7 @@ @class BookmarkBarFolderController; @class BookmarkButton; -class BookmarkDragData; +struct BookmarkDragData; class BookmarkModel; class BookmarkNode; @class BrowserWindowController; diff --git a/chrome/browser/cocoa/bookmark_editor_base_controller.mm b/chrome/browser/cocoa/bookmark_editor_base_controller.mm index 45bf44e..be367ae 100644 --- a/chrome/browser/cocoa/bookmark_editor_base_controller.mm +++ b/chrome/browser/cocoa/bookmark_editor_base_controller.mm @@ -20,8 +20,6 @@ @interface BookmarkEditorBaseController () -@property (retain, readwrite) NSArray* folderTreeArray; - // Return the folder tree object for the given path. - (BookmarkFolderInfo*)folderForIndexPath:(NSIndexPath*)path; diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index fa33dfb0..4b57df7 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -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. diff --git a/chrome/browser/cocoa/cookie_prompt_window_controller.mm b/chrome/browser/cocoa/cookie_prompt_window_controller.mm index f3dbcc0..1d53508b 100644 --- a/chrome/browser/cocoa/cookie_prompt_window_controller.mm +++ b/chrome/browser/cocoa/cookie_prompt_window_controller.mm @@ -120,7 +120,6 @@ static const CGFloat kExtraMarginForDetailsView = 10; [detailsViewController_ setContentObject:selectionAdapterObject_.get()]; - NSRect viewFrameRect = [disclosedViewPlaceholder_ frame]; [[disclosedViewPlaceholder_ superview] replaceSubview:disclosedViewPlaceholder_ with:[detailsViewController_ view]]; diff --git a/chrome/browser/cocoa/custom_home_pages_model.h b/chrome/browser/cocoa/custom_home_pages_model.h index 259a891..98ae8ba 100644 --- a/chrome/browser/cocoa/custom_home_pages_model.h +++ b/chrome/browser/cocoa/custom_home_pages_model.h @@ -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 } diff --git a/chrome/browser/cocoa/download_started_animation_mac.mm b/chrome/browser/cocoa/download_started_animation_mac.mm index 86e2b34..42c5c85 100644 --- a/chrome/browser/cocoa/download_started_animation_mac.mm +++ b/chrome/browser/cocoa/download_started_animation_mac.mm @@ -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) { diff --git a/chrome/browser/cocoa/extensions/browser_action_button.h b/chrome/browser/cocoa/extensions/browser_action_button.h index 62722b2..da701d8 100644 --- a/chrome/browser/cocoa/extensions/browser_action_button.h +++ b/chrome/browser/cocoa/extensions/browser_action_button.h @@ -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_; diff --git a/chrome/browser/cocoa/extensions/browser_action_button.mm b/chrome/browser/cocoa/extensions/browser_action_button.mm index a5a2ace..cb3c8d6 100644 --- a/chrome/browser/cocoa/extensions/browser_action_button.mm +++ b/chrome/browser/cocoa/extensions/browser_action_button.mm @@ -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. diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.h b/chrome/browser/cocoa/extensions/browser_actions_controller.h index f35fc0f..1c594b9 100644 --- a/chrome/browser/cocoa/extensions/browser_actions_controller.h +++ b/chrome/browser/cocoa/extensions/browser_actions_controller.h @@ -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_; diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/cocoa/extensions/browser_actions_controller.mm index e6df820..68ed120 100644 --- a/chrome/browser/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/cocoa/extensions/browser_actions_controller.mm @@ -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"; diff --git a/chrome/browser/cocoa/menu_controller.mm b/chrome/browser/cocoa/menu_controller.mm index d095a2e..259c905 100644 --- a/chrome/browser/cocoa/menu_controller.mm +++ b/chrome/browser/cocoa/menu_controller.mm @@ -141,7 +141,7 @@ static_cast<menus::MenuModel*>( [[sender representedObject] pointerValue]); DCHECK(model); - if (model); + if (model) model->ActivatedAt(modelIndex); } diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index b97bf7c..4eb6090 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -935,7 +935,7 @@ class PrefObserverBridge : public NotificationObserver, } // Getter for the |customPagesSource| property for bindings. -- (id)customPagesSource { +- (CustomHomePagesModel*)customPagesSource { return customPagesSource_.get(); } diff --git a/chrome/browser/cocoa/shell_dialogs_mac.mm b/chrome/browser/cocoa/shell_dialogs_mac.mm index 7c398e1..cffa35f 100644 --- a/chrome/browser/cocoa/shell_dialogs_mac.mm +++ b/chrome/browser/cocoa/shell_dialogs_mac.mm @@ -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))); } diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm index 811e3d6..cf39163 100644 --- a/chrome/browser/cocoa/tab_view.mm +++ b/chrome/browser/cocoa/tab_view.mm @@ -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]; diff --git a/chrome/browser/cocoa/url_drop_target.mm b/chrome/browser/cocoa/url_drop_target.mm index 8e3f19b..f0cf1fd 100644 --- a/chrome/browser/cocoa/url_drop_target.mm +++ b/chrome/browser/cocoa/url_drop_target.mm @@ -19,7 +19,7 @@ @implementation URLDropTargetHandler -- (id)initWithView:(NSView*)view { +- (id)initWithView:(NSView<URLDropTarget>*)view { if ((self = [super init])) { view_ = view; [view_ registerForDraggedTypes: diff --git a/chrome/browser/cocoa/web_drag_source.h b/chrome/browser/cocoa/web_drag_source.h index 425eb09..a853c6b 100644 --- a/chrome/browser/cocoa/web_drag_source.h +++ b/chrome/browser/cocoa/web_drag_source.h @@ -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. diff --git a/chrome/browser/cocoa/web_drop_target.h b/chrome/browser/cocoa/web_drop_target.h index 671b51f..7f18ccf 100644 --- a/chrome/browser/cocoa/web_drop_target.h +++ b/chrome/browser/cocoa/web_drop_target.h @@ -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; diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.h b/chrome/browser/renderer_host/render_widget_host_view_mac.h index 8f6f902..d12458c 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.h +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h @@ -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_; diff --git a/skia/ext/skia_utils_mac.h b/skia/ext/skia_utils_mac.h index 5b1e187..6db5421 100644 --- a/skia/ext/skia_utils_mac.h +++ b/skia/ext/skia_utils_mac.h @@ -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 |