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

Unified Diff: chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm

Issue 2247493003: [Mac] Clean up SadTabView and let SadTabController provide its content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use base::mac::ObjCCast Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm
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 747dfe23d8d0c9698334b120141cab037e39c88b..f8d9fa69ca40a5fbec0f2d4dae3e2043ba4cd8a3 100644
--- a/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.mm
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
+#import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
-#include "base/mac/bundle_locations.h"
#import "chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.h"
#include "chrome/common/url_constants.h"
+#include "chrome/grit/generated_resources.h"
+#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
using content::OpenURLParams;
@@ -36,7 +37,13 @@ void SadTabCocoa::Close() {
} // namespace chrome
-@implementation SadTabController
+@interface SadTabController ()<SadTabViewDelegate>
+@end
+
+@implementation SadTabController {
+ content::WebContents* webContents_;
+ SadTabView* sadTabView_;
+}
- (id)initWithWebContents:(content::WebContents*)webContents {
if ((self = [super init])) {
@@ -56,27 +63,34 @@ void SadTabCocoa::Close() {
}
- (void)dealloc {
- [[sadTabView_ reloadButton] setTarget:nil];
+ sadTabView_.delegate = nil;
[super dealloc];
}
- (void)loadView {
- sadTabView_.reset([[SadTabView alloc] init]);
- [[sadTabView_ reloadButton] setTarget:self];
- [[sadTabView_ reloadButton] setAction:@selector(reloadPage:)];
- [self setView:sadTabView_];
+ sadTabView_ = [[SadTabView new] autorelease];
+ sadTabView_.delegate = self;
+
+ [sadTabView_ setTitle:IDS_SAD_TAB_TITLE];
+ [sadTabView_ setMessage:IDS_SAD_TAB_MESSAGE];
+ [sadTabView_ setButtonTitle:IDS_SAD_TAB_RELOAD_LABEL];
+ [sadTabView_ setHelpLinkTitle:IDS_SAD_TAB_LEARN_MORE_LINK
+ URL:@(chrome::kCrashReasonURL)];
+
+ self.view = sadTabView_;
}
- (content::WebContents*)webContents {
return webContents_;
}
-- (IBAction)reloadPage:(id)sender {
+- (void)sadTabViewButtonClicked:(SadTabView*)sadTabView {
webContents_->GetController().Reload(true);
}
-- (void)openLearnMoreAboutCrashLink:(id)sender {
- OpenURLParams params(GURL(chrome::kCrashReasonURL), Referrer(), CURRENT_TAB,
+- (void)sadTabView:(SadTabView*)sadTabView
+ helpLinkClickedWithURL:(NSString*)url {
+ OpenURLParams params(GURL(url.UTF8String), Referrer(), CURRENT_TAB,
ui::PAGE_TRANSITION_LINK, false);
webContents_->OpenURL(params);
}

Powered by Google App Engine
This is Rietveld 408576698