diff options
Diffstat (limited to 'chrome/browser')
3 files changed, 2 insertions, 60 deletions
diff --git a/chrome/browser/cocoa/previewable_contents_controller.h b/chrome/browser/cocoa/previewable_contents_controller.h index 9b9b775..c4cc84e 100644 --- a/chrome/browser/cocoa/previewable_contents_controller.h +++ b/chrome/browser/cocoa/previewable_contents_controller.h @@ -26,9 +26,6 @@ class TabContents; // Container view for the "active" contents. IBOutlet NSView* activeContainer_; - // The close preview button. - IBOutlet NSButton* closeButton_; - // The preview TabContents. Will be NULL if no preview is currently showing. TabContents* previewContents_; // weak } @@ -45,9 +42,6 @@ class TabContents; // Returns YES if the preview contents is currently showing. - (BOOL)isShowingPreview; -// Simply calls |-hidePreview|. Convenience method for use by the close button. -- (IBAction)closePreview:(id)sender; - @end #endif // CHROME_BROWSER_COCOA_PREVIEWABLE_CONTENTS_CONTROLLER_H_ diff --git a/chrome/browser/cocoa/previewable_contents_controller.mm b/chrome/browser/cocoa/previewable_contents_controller.mm index fc738c4..8ce042d 100644 --- a/chrome/browser/cocoa/previewable_contents_controller.mm +++ b/chrome/browser/cocoa/previewable_contents_controller.mm @@ -8,12 +8,6 @@ #include "base/mac_util.h" #include "chrome/browser/tab_contents/tab_contents.h" -@interface PreviewableContentsController(PrivateMethods) -// Shows or hides the "close preview" button. Adds the button to the view -// hierarchy, if needed. -- (void)showCloseButton:(BOOL)show; -@end - @implementation PreviewableContentsController @synthesize activeContainer = activeContainer_; @@ -36,54 +30,23 @@ NSView* previewView = previewContents_->GetNativeView(); [previewView setFrame:[[self view] bounds]]; - // Hide the active container, add the preview contents, and show the tear - // image. + // Hide the active container and add the preview contents. [activeContainer_ setHidden:YES]; [[self view] addSubview:previewView]; - [self showCloseButton:YES]; } - (void)hidePreview { DCHECK(previewContents_); - // Remove the preview contents, hide the tear image, and reshow the active - // container. - [self showCloseButton:NO]; + // Remove the preview contents and reshow the active container. [previewContents_->GetNativeView() removeFromSuperview]; [activeContainer_ setHidden:NO]; previewContents_ = nil; } -- (IBAction)closePreview:(id)sender { - // Hiding right now leads to crashes. - // TODO(rohitrao): Actually hide the preview. -} - - (BOOL)isShowingPreview { return previewContents_ != nil; } @end - -@implementation PreviewableContentsController(PrivateMethods) - -- (void)showCloseButton:(BOOL)show { - if (!show) { - [closeButton_ removeFromSuperview]; - return; - } - - if ([closeButton_ superview]) - return; // Already in the view hierarchy. - - // Add the close button to the upper left corner. - NSView* view = [self view]; - NSRect frame = [closeButton_ frame]; - frame.origin.x = NSMinX([view bounds]); - frame.origin.y = NSMaxY([view bounds]) - NSHeight(frame); - [closeButton_ setFrame:frame]; - [view addSubview:closeButton_]; -} - -@end diff --git a/chrome/browser/cocoa/previewable_contents_controller_unittest.mm b/chrome/browser/cocoa/previewable_contents_controller_unittest.mm index c72f113..85e5c09 100644 --- a/chrome/browser/cocoa/previewable_contents_controller_unittest.mm +++ b/chrome/browser/cocoa/previewable_contents_controller_unittest.mm @@ -11,16 +11,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" -@interface PreviewableContentsController (ExposedForTesting) -- (NSButton*)closeButton; -@end - -@implementation PreviewableContentsController (ExposedForTesting) -- (NSButton*)closeButton { - return closeButton_; -} -@end - namespace { class PreviewableContentsControllerTest : public CocoaTest { @@ -36,11 +26,6 @@ class PreviewableContentsControllerTest : public CocoaTest { TEST_VIEW(PreviewableContentsControllerTest, [controller_ view]) -// Adds the view to a window and displays it. -TEST_F(PreviewableContentsControllerTest, TestImagesLoadedProperly) { - EXPECT_TRUE([[[controller_ closeButton] image] isValid]); -} - // TODO(rohitrao): Test showing and hiding the preview. This may require // changing the interface to take in a TabContentsView* instead of a // TabContents*. |