| Index: chrome/browser/tab_contents/web_contents_view_mac.mm
|
| ===================================================================
|
| --- chrome/browser/tab_contents/web_contents_view_mac.mm (revision 9874)
|
| +++ chrome/browser/tab_contents/web_contents_view_mac.mm (working copy)
|
| @@ -5,6 +5,7 @@
|
| #include "chrome/browser/tab_contents/web_contents_view_mac.h"
|
|
|
| #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful.
|
| +#include "chrome/browser/cocoa/sad_tab_view.h"
|
| #include "chrome/browser/renderer_host/render_widget_host.h"
|
| #include "chrome/browser/renderer_host/render_widget_host_view_mac.h"
|
| #include "chrome/browser/tab_contents/web_contents.h"
|
| @@ -18,6 +19,10 @@
|
|
|
| WebContentsViewMac::WebContentsViewMac(WebContents* web_contents)
|
| : web_contents_(web_contents) {
|
| + registrar_.Add(this, NotificationType::WEB_CONTENTS_CONNECTED,
|
| + Source<WebContents>(web_contents));
|
| + registrar_.Add(this, NotificationType::WEB_CONTENTS_DISCONNECTED,
|
| + Source<WebContents>(web_contents));
|
| }
|
|
|
| WebContentsViewMac::~WebContentsViewMac() {
|
| @@ -232,6 +237,34 @@
|
| widget_host->Init();
|
| }
|
|
|
| +void WebContentsViewMac::Observe(NotificationType type,
|
| + const NotificationSource& source,
|
| + const NotificationDetails& details) {
|
| + switch (type.value) {
|
| + case NotificationType::WEB_CONTENTS_CONNECTED: {
|
| + if (sad_tab_.get()) {
|
| + [sad_tab_.get() removeFromSuperview];
|
| + sad_tab_.reset();
|
| + }
|
| + break;
|
| + }
|
| + case NotificationType::WEB_CONTENTS_DISCONNECTED: {
|
| + SadTabView* view = [[SadTabView alloc] initWithFrame:NSZeroRect];
|
| + CFRetain(view);
|
| + [view release];
|
| + sad_tab_.reset(view);
|
| +
|
| + // Set as the dominant child.
|
| + [cocoa_view_.get() addSubview:view];
|
| + [view setFrame:[cocoa_view_.get() bounds]];
|
| + [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
| + break;
|
| + }
|
| + default:
|
| + NOTREACHED() << "Got a notification we didn't register for.";
|
| + }
|
| +}
|
| +
|
| @implementation WebContentsViewCocoa
|
|
|
| // Tons of stuff goes here, where we grab events going on in Cocoaland and send
|
|
|