diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-29 21:09:11 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-29 21:09:11 +0000 |
commit | 5901ab7c1e86520249f0ef2207db16f6ed713a59 (patch) | |
tree | 658dc5c4dfa0efcb0125088aa8d9a8e095a15850 /chrome | |
parent | c6b5012236f50fff596fa977beca80da428be7cc (diff) | |
download | chromium_src-5901ab7c1e86520249f0ef2207db16f6ed713a59.zip chromium_src-5901ab7c1e86520249f0ef2207db16f6ed713a59.tar.gz chromium_src-5901ab7c1e86520249f0ef2207db16f6ed713a59.tar.bz2 |
Deletes now-unused growbox code.
BUG=None
TEST=None. No visible impact.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/grow_box_view.h | 27 | ||||
-rw-r--r-- | chrome/browser/cocoa/grow_box_view.mm | 96 | ||||
-rw-r--r-- | chrome/browser/cocoa/grow_box_view_unittest.mm | 39 | ||||
-rw-r--r-- | chrome/chrome.gyp | 4 |
4 files changed, 0 insertions, 166 deletions
diff --git a/chrome/browser/cocoa/grow_box_view.h b/chrome/browser/cocoa/grow_box_view.h deleted file mode 100644 index de44366..0000000 --- a/chrome/browser/cocoa/grow_box_view.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2009 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. - -#ifndef CHROME_BROWSER_COCOA_GROW_BOX_VIEW_H_ -#define CHROME_BROWSER_COCOA_GROW_BOX_VIEW_H_ - -#import <Cocoa/Cocoa.h> - -#include "base/scoped_nsobject.h" - -// A class that handles drawing and mouse tracking to replace the standard -// window "grow box" grippy in cases where the OS one won't do. Relies on -// an image named "grow_box" be included in the application's resources. The -// box should be 15x15 in size, but that's not a requirement. - -@interface GrowBoxView : NSView { - @private - scoped_nsobject<NSImage> image_; // grow box image - NSPoint startPoint_; // location of the mouseDown event. - NSRect startFrame_; // original window frame. - NSRect clipRect_; // constrain the resized window to this frame. -} - -@end - -#endif // CHROME_BROWSER_COCOA_GROW_BOX_VIEW_H_ diff --git a/chrome/browser/cocoa/grow_box_view.mm b/chrome/browser/cocoa/grow_box_view.mm deleted file mode 100644 index cce8bb3..0000000 --- a/chrome/browser/cocoa/grow_box_view.mm +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2009 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. - -#import "chrome/browser/cocoa/grow_box_view.h" - -@interface GrowBoxView (PrivateMethods) - -// Computes the area in which the resized window can grow. This is -// the union of the current window frame and the work area of each -// screen. -// NOTE: If the lower right corner of the window is on a screen but -// outside its work area, we use the full area of that screen instead. -// The net effect is to closely mimic the resize behavior of other -// apps: the window is prevented from growing outside the work area, -// unless it is outside the work area to begin with. -- (void)computeClipRect; - -@end - -@implementation GrowBoxView - -- (void)awakeFromNib { - image_.reset([[NSImage imageNamed:@"grow_box"] retain]); -} - -- (void)dealloc { - [super dealloc]; -} - -// Draws the "grow_box" image in our bounds. -- (void)drawRect:(NSRect)dirtyRect { - [image_ drawInRect:[self bounds] fromRect:NSZeroRect - operation:NSCompositeSourceOver fraction:1.0]; -} - -- (void)mouseDown:(NSEvent*)event { - startPoint_ = [NSEvent mouseLocation]; - startFrame_ = [[self window] frame]; - [self computeClipRect]; -} - -// Called when the user clicks and drags within the bounds. Resize the window's -// frame based on the delta of the drag. -- (void)mouseDragged:(NSEvent*)event { - NSPoint point = [NSEvent mouseLocation]; - const int deltaX = point.x - startPoint_.x; - const int deltaY = point.y - startPoint_.y; - - NSRect frame = startFrame_; - frame.size.width = frame.size.width + deltaX; - frame.origin.y = frame.origin.y + deltaY; - frame.size.height = frame.size.height - deltaY; - - // Enforce that the frame is entirely contained within the computed clipRect. - if (NSMaxX(frame) > NSMaxX(clipRect_)) - frame.size.width = NSMaxX(clipRect_) - frame.origin.x; - if (NSMinY(frame) < NSMinY(clipRect_)) { - int maxY = NSMaxY(frame); - frame.origin.y = NSMinY(clipRect_); - frame.size.height = maxY - frame.origin.y; - } - - // Enforce min window size. - NSSize minSize = [[self window] minSize]; - if (frame.size.width < minSize.width) - frame.size.width = minSize.width; - if (frame.size.height < minSize.height) { - frame.origin.y = NSMaxY(startFrame_) - minSize.height; - frame.size.height = minSize.height; - } - - [[self window] setFrame:frame display:YES]; -} - -@end - -@implementation GrowBoxView (PrivateMethods) -- (void)computeClipRect { - // Start with the current frame. It makes sense to allow users to - // resize up to this size. - clipRect_ = startFrame_; - - // Calculate the union of all the screen work areas. If the lower - // right corner of the window is outside a work area, that use that - // screen's frame instead. - NSPoint lowerRight = NSMakePoint(NSMaxX(startFrame_), NSMinY(startFrame_)); - for (NSScreen* screen in [NSScreen screens]) { - if (!NSPointInRect(lowerRight, [screen visibleFrame]) && - NSPointInRect(lowerRight, [screen frame])) - clipRect_ = NSUnionRect(clipRect_, [screen frame]); - else - clipRect_ = NSUnionRect(clipRect_, [screen visibleFrame]); - } -} -@end diff --git a/chrome/browser/cocoa/grow_box_view_unittest.mm b/chrome/browser/cocoa/grow_box_view_unittest.mm deleted file mode 100644 index 88935ba..0000000 --- a/chrome/browser/cocoa/grow_box_view_unittest.mm +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2009 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. - -#import <Cocoa/Cocoa.h> - -#include "base/scoped_nsobject.h" -#import "chrome/browser/cocoa/grow_box_view.h" -#import "chrome/browser/cocoa/cocoa_test_helper.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -class GrowBoxViewTest : public testing::Test { - public: - GrowBoxViewTest() { - NSRect frame = NSMakeRect(0, 0, 15, 15); - view_.reset([[GrowBoxView alloc] initWithFrame:frame]); - [cocoa_helper_.contentView() addSubview:view_.get()]; - } - - scoped_nsobject<GrowBoxView> view_; - CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc... -}; - -// Test adding/removing from the view hierarchy, mostly to ensure nothing -// leaks or crashes. -TEST_F(GrowBoxViewTest, AddRemove) { - EXPECT_EQ(cocoa_helper_.contentView(), [view_ superview]); - [view_.get() removeFromSuperview]; - EXPECT_FALSE([view_ superview]); -} - -// Test drawing, mostly to ensure nothing leaks or crashes. -TEST_F(GrowBoxViewTest, Display) { - [view_ display]; -} - -} // namespace diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index bef298a..5039e50 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -744,8 +744,6 @@ 'browser/cocoa/first_run_dialog.mm', 'browser/cocoa/gradient_button_cell.h', 'browser/cocoa/gradient_button_cell.mm', - 'browser/cocoa/grow_box_view.h', - 'browser/cocoa/grow_box_view.mm', 'browser/cocoa/hung_renderer_controller.h', 'browser/cocoa/hung_renderer_controller.mm', 'browser/cocoa/location_bar_cell.h', @@ -2413,7 +2411,6 @@ 'app/theme/forward.pdf', 'app/theme/frozen_tab.png', 'app/theme/go.pdf', - 'app/theme/grow_box.png', 'app/theme/nav.pdf', 'app/theme/newtab.pdf', 'app/theme/o2_globe.png', @@ -3415,7 +3412,6 @@ 'browser/cocoa/location_bar_view_mac_unittest.mm', 'browser/cocoa/location_bar_fieldeditor_unittest.mm', 'browser/cocoa/gradient_button_cell_unittest.mm', - 'browser/cocoa/grow_box_view_unittest.mm', 'browser/cocoa/preferences_window_controller_unittest.mm', 'browser/cocoa/rwhvm_editcommand_helper_unittest.mm', 'browser/cocoa/sad_tab_view_unittest.mm', |