Home | History | Annotate | Download | only in tab_contents
      1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
      6 
      7 #include "base/mac/mac_util.h"
      8 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_view.h"
      9 
     10 @implementation SadTabController
     11 
     12 - (id)initWithTabContents:(TabContents*)someTabContents
     13                 superview:(NSView*)superview {
     14   if ((self = [super initWithNibName:@"SadTab"
     15                               bundle:base::mac::MainAppBundle()])) {
     16     tabContents_ = someTabContents;
     17 
     18     NSView* view = [self view];
     19     [superview addSubview:view];
     20     [view setFrame:[superview bounds]];
     21   }
     22 
     23   return self;
     24 }
     25 
     26 - (void)awakeFromNib {
     27   // If tab_contents_ is nil, ask view to remove link.
     28   if (!tabContents_) {
     29     SadTabView* sad_view = static_cast<SadTabView*>([self view]);
     30     [sad_view removeLinkButton];
     31   }
     32 }
     33 
     34 - (void)dealloc {
     35   [[self view] removeFromSuperview];
     36   [super dealloc];
     37 }
     38 
     39 - (TabContents*)tabContents {
     40   return tabContents_;
     41 }
     42 
     43 - (void)openLearnMoreAboutCrashLink:(id)sender {
     44   // Send the action up through the responder chain.
     45   [NSApp sendAction:@selector(openLearnMoreAboutCrashLink:) to:nil from:self];
     46 }
     47 
     48 @end
     49