summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authorkuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-15 19:52:37 +0000
committerkuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-15 19:52:37 +0000
commit27286e7a5905dcde71f834430b62235a40a2d020 (patch)
treee8153a6374f0dc66d369bf9be1eb83b164948f59 /chrome/browser/tab_contents
parent7d505dd8c384bafe4412c9625c358347bfc5770a (diff)
downloadchromium_src-27286e7a5905dcde71f834430b62235a40a2d020.zip
chromium_src-27286e7a5905dcde71f834430b62235a40a2d020.tar.gz
chromium_src-27286e7a5905dcde71f834430b62235a40a2d020.tar.bz2
mac: totally revamp "Aw Snap" page, implement new "Learn more" link, add unittests.
- totally revamp "Aw Snap" page to use xib resource, to reduce initialization code - new SadTabController: - controls SadTabView, via xib - uses TabContents in init, so as to launch url for link; used to use BrowserList::GetLastActive but that's null in chrome-frame release - if TabContents is nil, remove link in view - encapsulates the setting up and removing of its SadTabView within and shield them from TabContentsView, which only access the controller - SadTabView repositions and resizes subviews when browser window is resized, including (un)wrapping of message. - action for link is decoupled from target to facilitate unittesting - new SadTabControllerTest that tests initing controller with and without TabContents, and clicking on link BUG=27212 TEST=Verify that "Aw Snap" page shows up correctly, with the new "Learn more" link centered beneath the message. Contents should be centered in window when the latter resizes. If necessary, message should be wrapped, or unwrapped if previously wrapped and new width can accommodate. Review URL: http://codereview.chromium.org/432015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34585 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.h4
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.mm22
2 files changed, 12 insertions, 14 deletions
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.h b/chrome/browser/tab_contents/tab_contents_view_mac.h
index c3801a7..1e8e174b 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.h
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.h
@@ -19,7 +19,7 @@
class FilePath;
class FindBarMac;
@class FocusTracker;
-@class SadTabView;
+@class SadTabController;
class TabContentsViewMac;
@class WebDragSource;
@class WebDropTarget;
@@ -101,7 +101,7 @@ class TabContentsViewMac : public TabContentsView,
// Used to render the sad tab. This will be non-NULL only when the sad tab is
// visible.
- scoped_nsobject<SadTabView> sad_tab_;
+ scoped_nsobject<SadTabController> sad_tab_;
// The page content's intrinsic width.
int preferred_width_;
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index 14b16c6..8c1f3d6 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -14,7 +14,7 @@
#import "chrome/browser/cocoa/chrome_browser_window.h"
#import "chrome/browser/cocoa/browser_window_controller.h"
#include "chrome/browser/global_keyboard_shortcuts_mac.h"
-#include "chrome/browser/cocoa/sad_tab_view.h"
+#include "chrome/browser/cocoa/sad_tab_controller.h"
#import "chrome/browser/cocoa/web_drag_source.h"
#import "chrome/browser/cocoa/web_drop_target.h"
#include "chrome/browser/renderer_host/render_view_host_factory.h"
@@ -158,13 +158,14 @@ void TabContentsViewMac::SetPageTitle(const std::wstring& title) {
void TabContentsViewMac::OnTabCrashed() {
if (!sad_tab_.get()) {
- SadTabView* view = [[SadTabView alloc] initWithFrame:NSZeroRect];
- sad_tab_.reset(view);
-
- // Set as the dominant child.
- [cocoa_view_.get() addSubview:view];
- [view setFrame:[cocoa_view_.get() bounds]];
- [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+ TabContents* contents = tab_contents();
+ DCHECK(contents);
+ if (contents) {
+ SadTabController* sad_tab =
+ [[SadTabController alloc] initWithTabContents:contents
+ superview:cocoa_view_];
+ sad_tab_.reset(sad_tab);
+ }
}
}
@@ -295,10 +296,7 @@ void TabContentsViewMac::Observe(NotificationType type,
const NotificationDetails& details) {
switch (type.value) {
case NotificationType::TAB_CONTENTS_CONNECTED: {
- if (sad_tab_.get()) {
- [sad_tab_.get() removeFromSuperview];
- sad_tab_.reset();
- }
+ sad_tab_.reset();
break;
}
default: