From 27286e7a5905dcde71f834430b62235a40a2d020 Mon Sep 17 00:00:00 2001 From: "kuan@chromium.org" Date: Tue, 15 Dec 2009 19:52:37 +0000 Subject: mac: totally revamp "Aw Snap" page, implement new "Learn more" link, add unittests. - totally revamp "Aw Snap" page to use xib resource, to reduce initialization code - new SadTabController: - controls SadTabView, via xib - uses TabContents in init, so as to launch url for link; used to use BrowserList::GetLastActive but that's null in chrome-frame release - if TabContents is nil, remove link in view - encapsulates the setting up and removing of its SadTabView within and shield them from TabContentsView, which only access the controller - SadTabView repositions and resizes subviews when browser window is resized, including (un)wrapping of message. - action for link is decoupled from target to facilitate unittesting - new SadTabControllerTest that tests initing controller with and without TabContents, and clicking on link BUG=27212 TEST=Verify that "Aw Snap" page shows up correctly, with the new "Learn more" link centered beneath the message. Contents should be centered in window when the latter resizes. If necessary, message should be wrapped, or unwrapped if previously wrapped and new width can accommodate. Review URL: http://codereview.chromium.org/432015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34585 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/sad_tab_controller.h | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 chrome/browser/cocoa/sad_tab_controller.h (limited to 'chrome/browser/cocoa/sad_tab_controller.h') diff --git a/chrome/browser/cocoa/sad_tab_controller.h b/chrome/browser/cocoa/sad_tab_controller.h new file mode 100644 index 0000000..148729a --- /dev/null +++ b/chrome/browser/cocoa/sad_tab_controller.h @@ -0,0 +1,32 @@ +// 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_SAD_TAB_CONTROLLER_H_ +#define CHROME_BROWSER_COCOA_SAD_TAB_CONTROLLER_H_ + +#import + +class TabContents; + +// A controller class that manages the SadTabView (aka "Aw Snap" or crash page). +@interface SadTabController : NSViewController { + @private + TabContents* tabContents_; // Weak reference. +} + +// Designated initializer is initWithTabContents. +- (id)initWithTabContents:(TabContents*)someTabContents + superview:(NSView*)superview; + +// This action just calls the NSApp sendAction to get it into the standard +// Cocoa action processing. +- (IBAction)openLearnMoreAboutCrashLink:(id)sender; + +// Returns a weak reference to the TabContents whose TabContentsView created +// this SadTabController. +- (TabContents*)tabContents; + +@end + +#endif // CHROME_BROWSER_COCOA_SAD_TAB_CONTROLLER_H_ -- cgit v1.1