Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / tab_contents / sad_tab_controller.mm
bloba2073e17f10b135f625c620c1ce38f5a55f2388f
1 // Copyright (c) 2011 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.
5 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
7 #include "base/mac/bundle_locations.h"
8 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.h"
9 #include "content/public/browser/web_contents.h"
11 namespace chrome {
13 SadTab* SadTab::Create(content::WebContents* web_contents, SadTabKind kind) {
14   return new SadTabCocoa(web_contents);
17 SadTabCocoa::SadTabCocoa(content::WebContents* web_contents)
18     : web_contents_(web_contents) {
21 SadTabCocoa::~SadTabCocoa() {
24 void SadTabCocoa::Show() {
25   sad_tab_controller_.reset(
26       [[SadTabController alloc] initWithWebContents:web_contents_]);
29 void SadTabCocoa::Close() {
30   [[sad_tab_controller_ view] removeFromSuperview];
33 }  // namespace chrome
35 @implementation SadTabController
37 - (id)initWithWebContents:(content::WebContents*)webContents {
38   if ((self = [super init])) {
39     webContents_ = webContents;
41     if (webContents_) {  // NULL in unit_tests.
42       NSView* ns_view = webContents_->GetNativeView();
43       [[self view] setAutoresizingMask:
44           (NSViewWidthSizable | NSViewHeightSizable)];
45       [ns_view addSubview:[self view]];
46       [[self view] setFrame:[ns_view bounds]];
47     }
48   }
50   return self;
53 - (void)loadView {
54   base::scoped_nsobject<SadTabView> sadView([[SadTabView alloc] init]);
55   if (!webContents_)
56     [sadView removeHelpText];
57   [self setView:sadView];
60 - (content::WebContents*)webContents {
61   return webContents_;
64 @end