diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-24 19:55:06 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-24 19:55:06 +0000 |
commit | 1503de36be46c5d273254bc7023b440f291e4be1 (patch) | |
tree | d3bf52c987624d5aeda93c4739ea7e83f225d4d8 /chrome/browser/ui | |
parent | c8e9d7c02b3847f7abe85991025efcbcda17f20f (diff) | |
download | chromium_src-1503de36be46c5d273254bc7023b440f291e4be1.zip chromium_src-1503de36be46c5d273254bc7023b440f291e4be1.tar.gz chromium_src-1503de36be46c5d273254bc7023b440f291e4be1.tar.bz2 |
Objective-C readability review for Robert Sesek <rsesek@google.com>.
OCL=http://codereview.chromium.org/3461016/
BUG=http://b/3372125
TEST=none
R=pinkerton
Review URL: http://codereview.chromium.org/6360007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
3 files changed, 18 insertions, 15 deletions
diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller.h b/chrome/browser/ui/cocoa/page_info_bubble_controller.h index 10909c6..1b21215 100644 --- a/chrome/browser/ui/cocoa/page_info_bubble_controller.h +++ b/chrome/browser/ui/cocoa/page_info_bubble_controller.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -23,11 +23,12 @@ int certID_; } -@property (nonatomic, assign) int certID; +@property(nonatomic, assign) int certID; // Designated initializer. The new instance will take ownership of |model| and // |bridge|. There should be a 1:1 mapping of models to bridges. The -// controller will release itself when the bubble is closed. +// controller will release itself when the bubble is closed. |parentWindow| +// cannot be nil. - (id)initWithPageInfoModel:(PageInfoModel*)model modelObserver:(PageInfoModel::PageInfoModelObserver*)bridge parentWindow:(NSWindow*)parentWindow; diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm index bd05241..d79ef5c 100644 --- a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -53,8 +53,7 @@ // bubble's window's contentView. Drawing is flipped so that layout of the // sections is easier. Apple recommends flipping the coordinate origin when // doing a lot of text layout because it's more natural. -@interface PageInfoContentView : NSView { -} +@interface PageInfoContentView : NSView @end @implementation PageInfoContentView - (BOOL)isFlipped { @@ -66,19 +65,19 @@ namespace { // The width of the window, in view coordinates. The height will be determined // by the content. -const NSInteger kWindowWidth = 380; +const CGFloat kWindowWidth = 380; // Spacing in between sections. -const NSInteger kVerticalSpacing = 10; +const CGFloat kVerticalSpacing = 10; // Padding along on the X-axis between the window frame and content. -const NSInteger kFramePadding = 10; +const CGFloat kFramePadding = 10; // Spacing between the optional headline and description text views. -const NSInteger kHeadlineSpacing = 2; +const CGFloat kHeadlineSpacing = 2; // Spacing between the image and the text. -const NSInteger kImageSpacing = 10; +const CGFloat kImageSpacing = 10; // Square size of the image. const CGFloat kImageSize = 30; @@ -135,6 +134,8 @@ class PageInfoModelBubbleBridge : public PageInfoModel::PageInfoModelObserver { // Factory that vends RunnableMethod tasks for scheduling layout. ScopedRunnableMethodFactory<PageInfoModelBubbleBridge> task_factory_; + + DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge); }; } // namespace @@ -167,6 +168,8 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, - (id)initWithPageInfoModel:(PageInfoModel*)model modelObserver:(PageInfoModel::PageInfoModelObserver*)bridge parentWindow:(NSWindow*)parentWindow { + DCHECK(parentWindow); + // Use an arbitrary height because it will be changed by the bridge. NSRect contentRect = NSMakeRect(0, 0, kWindowWidth, 0); // Create an empty window into which content is placed. @@ -394,8 +397,8 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, - (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info toSubviews:(NSMutableArray*)subviews atOffset:(CGFloat)offset { - NSRect frame = NSMakeRect(kFramePadding, offset, kImageSize, - kImageSize); + NSRect frame = + NSMakeRect(kFramePadding, offset, kImageSize, kImageSize); scoped_nsobject<NSImageView> imageView( [[NSImageView alloc] initWithFrame:frame]); [imageView setImageFrameStyle:NSImageFrameNone]; diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm index 0ad5054..cc640d0 100644 --- a/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -186,7 +186,6 @@ TEST_F(PageInfoBubbleControllerTest, NoHistoryMixedSecurity) { description, PageInfoModel::SECTION_INFO_CONNECTION); - CreateBubble(); [controller_ setCertID:1]; [controller_ performLayout]; |