diff options
author | andresantoso <andresantoso@chromium.org> | 2015-05-27 13:51:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-27 20:51:42 +0000 |
commit | 0f774ac3eab74c0b3102c3f6c16e0733de0dcfa7 (patch) | |
tree | 00c859027e903f1bf9fde69ac8f08238ef8cb94c /chrome | |
parent | 8505ef356013ec9239f295501a283ec9fd43b08a (diff) | |
download | chromium_src-0f774ac3eab74c0b3102c3f6c16e0733de0dcfa7.zip chromium_src-0f774ac3eab74c0b3102c3f6c16e0733de0dcfa7.tar.gz chromium_src-0f774ac3eab74c0b3102c3f6c16e0733de0dcfa7.tar.bz2 |
Mac: Update sad tab to no longer use a xib file
The xib file was used to set up the image view, replace it with code.
It was also used to set an outlet to the controller, it's not really needed.
Also, SadTabView does not need to be a subclass of BaseView.
BUG=490139
Review URL: https://codereview.chromium.org/1158223002
Cr-Commit-Position: refs/heads/master@{#331643}
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/nibs/SadTab.xib | 437 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm | 19 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.h | 9 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.mm | 66 | ||||
-rw-r--r-- | chrome/chrome_nibs.gyp | 4 | ||||
-rw-r--r-- | chrome/chrome_nibs.gypi | 1 |
7 files changed, 43 insertions, 497 deletions
diff --git a/chrome/app/nibs/SadTab.xib b/chrome/app/nibs/SadTab.xib deleted file mode 100644 index a64a839..0000000 --- a/chrome/app/nibs/SadTab.xib +++ /dev/null @@ -1,437 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> - <data> - <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">12B19</string> - <string key="IBDocument.InterfaceBuilderVersion">2549</string> - <string key="IBDocument.AppKitVersion">1187</string> - <string key="IBDocument.HIToolboxVersion">624.00</string> - <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="NS.object.0">2549</string> - </object> - <object class="NSArray" key="IBDocument.IntegratedClassDependencies"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>NSCustomObject</string> - <string>NSCustomView</string> - <string>NSImageCell</string> - <string>NSImageView</string> - </object> - <object class="NSArray" key="IBDocument.PluginDependencies"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - </object> - <object class="NSMutableDictionary" key="IBDocument.Metadata"> - <string key="NS.key.0">PluginDependencyRecalculationVersion</string> - <integer value="1" key="NS.object.0"/> - </object> - <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSCustomObject" id="1001"> - <string key="NSClassName">SadTabController</string> - </object> - <object class="NSCustomObject" id="1003"> - <string key="NSClassName">FirstResponder</string> - </object> - <object class="NSCustomObject" id="1004"> - <string key="NSClassName">NSApplication</string> - </object> - <object class="NSCustomView" id="1005"> - <reference key="NSNextResponder"/> - <int key="NSvFlags">274</int> - <object class="NSMutableArray" key="NSSubviews"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSImageView" id="48169842"> - <reference key="NSNextResponder" ref="1005"/> - <int key="NSvFlags">301</int> - <object class="NSMutableSet" key="NSDragTypes"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="set.sortedObjects"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>Apple PDF pasteboard type</string> - <string>Apple PICT pasteboard type</string> - <string>Apple PNG pasteboard type</string> - <string>NSFilenamesPboardType</string> - <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> - <string>NeXT TIFF v4.0 pasteboard type</string> - </object> - </object> - <string key="NSFrame">{{16, 74}, {66, 66}}</string> - <reference key="NSSuperview" ref="1005"/> - <reference key="NSWindow"/> - <bool key="NSEnabled">YES</bool> - <object class="NSImageCell" key="NSCell" id="517261740"> - <int key="NSCellFlags">134217728</int> - <int key="NSCellFlags2">33554432</int> - <int key="NSAlign">0</int> - <int key="NSScale">0</int> - <int key="NSStyle">0</int> - <bool key="NSAnimates">NO</bool> - </object> - <bool key="NSAllowsLogicalLayoutDirection">NO</bool> - <bool key="NSEditable">YES</bool> - </object> - </object> - <string key="NSFrameSize">{97, 95}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> - <string key="NSClassName">SadTabView</string> - </object> - <object class="NSCustomObject" id="125577469"> - <string key="NSClassName">ChromeUILocalizer</string> - </object> - <object class="NSCustomObject" id="773582804"> - <string key="NSClassName">GTMUILocalizerAndLayoutTweaker</string> - </object> - </object> - <object class="IBObjectContainer" key="IBDocument.Objects"> - <object class="NSMutableArray" key="connectionRecords"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">view</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="1005"/> - </object> - <int key="connectionID">18</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">image_</string> - <reference key="source" ref="1005"/> - <reference key="destination" ref="48169842"/> - </object> - <int key="connectionID">40</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">controller_</string> - <reference key="source" ref="1005"/> - <reference key="destination" ref="1001"/> - </object> - <int key="connectionID">51</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">localizer_</string> - <reference key="source" ref="773582804"/> - <reference key="destination" ref="125577469"/> - </object> - <int key="connectionID">21</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">uiObject_</string> - <reference key="source" ref="773582804"/> - <reference key="destination" ref="1005"/> - </object> - <int key="connectionID">22</int> - </object> - </object> - <object class="IBMutableOrderedSet" key="objectRecords"> - <object class="NSArray" key="orderedObjects"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBObjectRecord"> - <int key="objectID">0</int> - <object class="NSArray" key="object" id="1002"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> - <reference key="children" ref="1000"/> - <nil key="parent"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">-2</int> - <reference key="object" ref="1001"/> - <reference key="parent" ref="1002"/> - <string key="objectName">File's Owner</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">-1</int> - <reference key="object" ref="1003"/> - <reference key="parent" ref="1002"/> - <string key="objectName">First Responder</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">-3</int> - <reference key="object" ref="1004"/> - <reference key="parent" ref="1002"/> - <string key="objectName">Application</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1</int> - <reference key="object" ref="1005"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="48169842"/> - </object> - <reference key="parent" ref="1002"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">19</int> - <reference key="object" ref="125577469"/> - <reference key="parent" ref="1002"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">20</int> - <reference key="object" ref="773582804"/> - <reference key="parent" ref="1002"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">26</int> - <reference key="object" ref="48169842"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="517261740"/> - </object> - <reference key="parent" ref="1005"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">29</int> - <reference key="object" ref="517261740"/> - <reference key="parent" ref="48169842"/> - </object> - </object> - </object> - <object class="NSMutableDictionary" key="flattenedProperties"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>-1.IBPluginDependency</string> - <string>-2.IBPluginDependency</string> - <string>-3.IBPluginDependency</string> - <string>1.IBPluginDependency</string> - <string>19.IBPluginDependency</string> - <string>20.IBPluginDependency</string> - <string>24.IBPluginDependency</string> - <string>25.IBPluginDependency</string> - <string>26.IBPluginDependency</string> - <string>29.IBPluginDependency</string> - <string>30.IBPluginDependency</string> - <string>31.IBPluginDependency</string> - <string>47.IBPluginDependency</string> - <string>48.IBPluginDependency</string> - </object> - <object class="NSArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - </object> - </object> - <object class="NSMutableDictionary" key="unlocalizedProperties"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference key="dict.sortedKeys" ref="1002"/> - <reference key="dict.values" ref="1002"/> - </object> - <nil key="activeLocalization"/> - <object class="NSMutableDictionary" key="localizations"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference key="dict.sortedKeys" ref="1002"/> - <reference key="dict.values" ref="1002"/> - </object> - <nil key="sourceID"/> - <int key="maxID">51</int> - </object> - <object class="IBClassDescriber" key="IBDocument.Classes"> - <object class="NSMutableArray" key="referencedPartialClassDescriptions"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBPartialClassDescription"> - <string key="className">BaseView</string> - <string key="superclassName">NSView</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/BaseView.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">ChromeUILocalizer</string> - <string key="superclassName">GTMUILocalizer</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/ChromeUILocalizer.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">GTMUILocalizer</string> - <string key="superclassName">NSObject</string> - <object class="NSMutableDictionary" key="outlets"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>otherObjectToLocalize_</string> - <string>owner_</string> - <string>yetAnotherObjectToLocalize_</string> - </object> - <object class="NSArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>id</string> - <string>id</string> - <string>id</string> - </object> - </object> - <object class="NSMutableDictionary" key="toOneOutletInfosByName"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>otherObjectToLocalize_</string> - <string>owner_</string> - <string>yetAnotherObjectToLocalize_</string> - </object> - <object class="NSArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBToOneOutletInfo"> - <string key="name">otherObjectToLocalize_</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBToOneOutletInfo"> - <string key="name">owner_</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBToOneOutletInfo"> - <string key="name">yetAnotherObjectToLocalize_</string> - <string key="candidateClassName">id</string> - </object> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/GTMUILocalizer.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">GTMUILocalizerAndLayoutTweaker</string> - <string key="superclassName">NSObject</string> - <object class="NSMutableDictionary" key="outlets"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>localizerOwner_</string> - <string>localizer_</string> - <string>uiObject_</string> - </object> - <object class="NSArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>id</string> - <string>GTMUILocalizer</string> - <string>id</string> - </object> - </object> - <object class="NSMutableDictionary" key="toOneOutletInfosByName"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>localizerOwner_</string> - <string>localizer_</string> - <string>uiObject_</string> - </object> - <object class="NSArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBToOneOutletInfo"> - <string key="name">localizerOwner_</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBToOneOutletInfo"> - <string key="name">localizer_</string> - <string key="candidateClassName">GTMUILocalizer</string> - </object> - <object class="IBToOneOutletInfo"> - <string key="name">uiObject_</string> - <string key="candidateClassName">id</string> - </object> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/GTMUILocalizerAndLayoutTweaker.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">SadTabController</string> - <string key="superclassName">NSViewController</string> - <object class="NSMutableDictionary" key="actions"> - <string key="NS.key.0">openLearnMoreAboutCrashLink:</string> - <string key="NS.object.0">id</string> - </object> - <object class="NSMutableDictionary" key="actionInfosByName"> - <string key="NS.key.0">openLearnMoreAboutCrashLink:</string> - <object class="IBActionInfo" key="NS.object.0"> - <string key="name">openLearnMoreAboutCrashLink:</string> - <string key="candidateClassName">id</string> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/SadTabController.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">SadTabView</string> - <string key="superclassName">BaseView</string> - <object class="NSMutableDictionary" key="outlets"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>controller_</string> - <string>image_</string> - </object> - <object class="NSArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>SadTabController</string> - <string>NSImageView</string> - </object> - </object> - <object class="NSMutableDictionary" key="toOneOutletInfosByName"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>controller_</string> - <string>image_</string> - </object> - <object class="NSArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBToOneOutletInfo"> - <string key="name">controller_</string> - <string key="candidateClassName">SadTabController</string> - </object> - <object class="IBToOneOutletInfo"> - <string key="name">image_</string> - <string key="candidateClassName">NSImageView</string> - </object> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/SadTabView.h</string> - </object> - </object> - </object> - </object> - <int key="IBDocument.localizationMode">0</int> - <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string> - <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> - <integer value="1050" key="NS.object.0"/> - </object> - <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> - <real value="1070" key="NS.object.0"/> - </object> - <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> - <integer value="3000" key="NS.object.0"/> - </object> - <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> - <int key="IBDocument.defaultPropertyAccessControl">3</int> - </data> -</archive> diff --git a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h index ad3e923..275d101c 100644 --- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h +++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h @@ -45,10 +45,6 @@ class SadTabCocoa : public SadTab { // Designated initializer. - (id)initWithWebContents:(content::WebContents*)webContents; -// 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 WebContents whose WebContentsView created // this SadTabController. - (content::WebContents*)webContents; diff --git a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm index 981dcba..a2073e1 100644 --- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm +++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm @@ -35,8 +35,7 @@ void SadTabCocoa::Close() { @implementation SadTabController - (id)initWithWebContents:(content::WebContents*)webContents { - if ((self = [super initWithNibName:@"SadTab" - bundle:base::mac::FrameworkBundle()])) { + if ((self = [super init])) { webContents_ = webContents; if (webContents_) { // NULL in unit_tests. @@ -51,21 +50,15 @@ void SadTabCocoa::Close() { return self; } -- (void)awakeFromNib { - // If webContents_ is nil, ask view to remove link. - if (!webContents_) { - SadTabView* sad_view = static_cast<SadTabView*>([self view]); - [sad_view removeHelpText]; - } +- (void)loadView { + base::scoped_nsobject<SadTabView> sadView([[SadTabView alloc] init]); + if (!webContents_) + [sadView removeHelpText]; + [self setView:sadView]; } - (content::WebContents*)webContents { return webContents_; } -- (void)openLearnMoreAboutCrashLink:(id)sender { - // Send the action up through the responder chain. - [NSApp sendAction:@selector(openLearnMoreAboutCrashLink:) to:nil from:self]; -} - @end diff --git a/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.h b/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.h index a1c5b73..306ad4c 100644 --- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.h +++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.h @@ -6,25 +6,20 @@ #define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_SAD_TAB_VIEW_COCOA_H_ #include "base/mac/scoped_nsobject.h" -#include "ui/base/cocoa/base_view.h" #import <Cocoa/Cocoa.h> -@class SadTabController; @class HyperlinkTextView; // A view that displays the "sad tab" (aka crash page). -@interface SadTabView : BaseView<NSTextViewDelegate> { +@interface SadTabView : NSView<NSTextViewDelegate> { @private - IBOutlet NSImageView* image_; + base::scoped_nsobject<NSImageView> image_; base::scoped_nsobject<NSTextField> title_; base::scoped_nsobject<NSTextField> message_; base::scoped_nsobject<HyperlinkTextView> help_; NSSize messageSize_; - - // A weak reference to the parent controller. - IBOutlet SadTabController* controller_; } // Designated initializer is -initWithFrame: . diff --git a/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.mm b/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.mm index 51e8306..3a32f1f 100644 --- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.mm +++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.mm @@ -6,7 +6,6 @@ #include "base/logging.h" #include "base/strings/sys_string_conversions.h" -#include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" #include "chrome/common/url_constants.h" #include "chrome/grit/generated_resources.h" #include "grit/theme_resources.h" @@ -28,6 +27,8 @@ static const CGFloat kTitleMessageSpacing = 15; static const CGFloat kMessageLinkSpacing = 15; // Paddings on left and right of page. static const CGFloat kTabHorzMargin = 13; +// The width and height of the icon image view. +static const CGFloat kIconViewSize = 66; @interface SadTabTextView : NSTextField @@ -58,36 +59,40 @@ static const CGFloat kTabHorzMargin = 13; @implementation SadTabView -- (void)awakeFromNib { - // Load resource for image and set it. - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - NSImage* image = rb.GetNativeImageNamed(IDR_SAD_TAB).ToNSImage(); - [image_ setImage:image]; - - // Initialize background color. - NSColor* backgroundColor = [NSColor colorWithCalibratedWhite:247.0f/255.0f - alpha:1.0]; - [self setWantsLayer:YES]; - [[self layer] setBackgroundColor:[backgroundColor cr_CGColor]]; - - // Set up the title. - title_.reset([[SadTabTextView alloc] - initWithView:self withText:IDS_SAD_TAB_TITLE]); - [title_ setFont:[NSFont systemFontOfSize:24]]; - [title_ setBackgroundColor:backgroundColor]; - [title_ setTextColor:[NSColor colorWithCalibratedWhite:51.0f/255.0f - alpha:1.0]]; - - // Set up the message. - message_.reset([[SadTabTextView alloc] - initWithView:self withText:IDS_SAD_TAB_MESSAGE]); - [message_ setFont:[NSFont systemFontOfSize:15]]; - [message_ setBackgroundColor:backgroundColor]; - [message_ setTextColor:[NSColor colorWithCalibratedWhite:100.0f/255.0f +- (instancetype)initWithFrame:(NSRect)frame { + if ((self = [super initWithFrame:frame])) { + // Load resource for image and set it. + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + image_.reset([[NSImageView alloc] + initWithFrame:NSMakeRect(0, 0, kIconViewSize, kIconViewSize)]); + [image_ setImage:rb.GetNativeImageNamed(IDR_SAD_TAB).ToNSImage()]; + [self addSubview:image_]; + + // Initialize background color. + NSColor* backgroundColor = [NSColor colorWithCalibratedWhite:247.0f/255.0f + alpha:1.0]; + [self setWantsLayer:YES]; + [[self layer] setBackgroundColor:[backgroundColor cr_CGColor]]; + + // Set up the title. + title_.reset([[SadTabTextView alloc] + initWithView:self withText:IDS_SAD_TAB_TITLE]); + [title_ setFont:[NSFont systemFontOfSize:24]]; + [title_ setBackgroundColor:backgroundColor]; + [title_ setTextColor:[NSColor colorWithCalibratedWhite:51.0f/255.0f alpha:1.0]]; - DCHECK(controller_); - [self initializeHelpText]; + // Set up the message. + message_.reset([[SadTabTextView alloc] + initWithView:self withText:IDS_SAD_TAB_MESSAGE]); + [message_ setFont:[NSFont systemFontOfSize:15]]; + [message_ setBackgroundColor:backgroundColor]; + [message_ setTextColor:[NSColor colorWithCalibratedWhite:100.0f/255.0f + alpha:1.0]]; + + [self initializeHelpText]; + } + return self; } - (void)resizeSubviewsWithOldSize:(NSSize)oldSize { @@ -192,8 +197,7 @@ static const CGFloat kTabHorzMargin = 13; - (BOOL)textView:(NSTextView*)textView clickedOnLink:(id)link atIndex:(NSUInteger)charIndex { - if (controller_) - [controller_ openLearnMoreAboutCrashLink:nil]; + [NSApp sendAction:@selector(openLearnMoreAboutCrashLink:) to:nil from:self]; return YES; } diff --git a/chrome/chrome_nibs.gyp b/chrome/chrome_nibs.gyp index a5c9bc2..1ab195f 100644 --- a/chrome/chrome_nibs.gyp +++ b/chrome/chrome_nibs.gyp @@ -203,10 +203,6 @@ 'browser/ui/cocoa/styled_text_field_cell.mm', 'browser/ui/cocoa/tab_contents/overlayable_contents_controller.h', 'browser/ui/cocoa/tab_contents/overlayable_contents_controller.mm', - 'browser/ui/cocoa/tab_contents/sad_tab_controller.h', - 'browser/ui/cocoa/tab_contents/sad_tab_controller.mm', - 'browser/ui/cocoa/tab_contents/sad_tab_view.h', - 'browser/ui/cocoa/tab_contents/sad_tab_view.mm', 'browser/ui/cocoa/tabs/tab_controller.h', 'browser/ui/cocoa/tabs/tab_controller.mm', 'browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h', diff --git a/chrome/chrome_nibs.gypi b/chrome/chrome_nibs.gypi index d90e021..6c6632e 100644 --- a/chrome/chrome_nibs.gypi +++ b/chrome/chrome_nibs.gypi @@ -59,7 +59,6 @@ 'app/nibs/HungRendererDialog.xib', 'app/nibs/InfoBar.xib', 'app/nibs/Panel.xib', - 'app/nibs/SadTab.xib', ], # mac_untranslated_xibs 'mac_all_xibs': [ '<@(mac_translated_xibs)', |