Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: components/sad_tab/cocoa/sad_tab_controller.mm

Issue 543663002: Componentize sad_tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix url_constants.cc Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" 5 #include "components/sad_tab/cocoa/sad_tab_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_view.h" 9 #import "components/sad_tab/cocoa/sad_tab_view.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
11 11
12 namespace chrome { 12 namespace sad_tab {
13 13
14 SadTab* SadTab::Create(content::WebContents* web_contents, SadTabKind kind) { 14 SadTab* SadTab::Create(content::WebContents* web_contents,
15 SadTabKind kind,
16 SadTabClient* client) {
15 return new SadTabCocoa(web_contents); 17 return new SadTabCocoa(web_contents);
16 } 18 }
17 19
18 SadTabCocoa::SadTabCocoa(content::WebContents* web_contents) 20 SadTabCocoa::SadTabCocoa(content::WebContents* web_contents)
19 : web_contents_(web_contents) { 21 : web_contents_(web_contents) {
20 } 22 }
21 23
22 SadTabCocoa::~SadTabCocoa() { 24 SadTabCocoa::~SadTabCocoa() {
23 } 25 }
24 26
25 void SadTabCocoa::Show() { 27 void SadTabCocoa::Show() {
26 sad_tab_controller_.reset( 28 sad_tab_controller_.reset(
27 [[SadTabController alloc] initWithWebContents:web_contents_]); 29 [[SadTabController alloc] initWithWebContents:web_contents_]);
28 } 30 }
29 31
30 void SadTabCocoa::Close() { 32 void SadTabCocoa::Close() {
31 [[sad_tab_controller_ view] removeFromSuperview]; 33 [[sad_tab_controller_ view] removeFromSuperview];
32 } 34 }
33 35
34 } // namespace chrome 36 } // namespace sad_tab
35 37
36 @implementation SadTabController 38 @implementation SadTabController
37 39
38 - (id)initWithWebContents:(content::WebContents*)webContents { 40 - (id)initWithWebContents:(content::WebContents*)webContents {
39 if ((self = [super initWithNibName:@"SadTab" 41 if ((self = [super initWithNibName:@"SadTab"
40 bundle:base::mac::FrameworkBundle()])) { 42 bundle:base::mac::FrameworkBundle()])) {
41 webContents_ = webContents; 43 webContents_ = webContents;
42 44
43 if (webContents_) { // NULL in unit_tests. 45 if (webContents_) { // NULL in unit_tests.
44 NSView* ns_view = webContents_->GetNativeView(); 46 NSView* ns_view = webContents_->GetNativeView();
(...skipping 18 matching lines...) Expand all
63 - (content::WebContents*)webContents { 65 - (content::WebContents*)webContents {
64 return webContents_; 66 return webContents_;
65 } 67 }
66 68
67 - (void)openLearnMoreAboutCrashLink:(id)sender { 69 - (void)openLearnMoreAboutCrashLink:(id)sender {
68 // Send the action up through the responder chain. 70 // Send the action up through the responder chain.
69 [NSApp sendAction:@selector(openLearnMoreAboutCrashLink:) to:nil from:self]; 71 [NSApp sendAction:@selector(openLearnMoreAboutCrashLink:) to:nil from:self];
70 } 72 }
71 73
72 @end 74 @end
OLDNEW
« no previous file with comments | « components/sad_tab/cocoa/sad_tab_controller.h ('k') | components/sad_tab/cocoa/sad_tab_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698