| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tab_contents/tab_contents_view_mac.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. | 7 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. |
| 8 #include "chrome/browser/cocoa/sad_tab_view.h" | 8 #include "chrome/browser/cocoa/sad_tab_view.h" |
| 9 #include "chrome/browser/renderer_host/render_widget_host.h" | 9 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 10 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 10 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 cocoa_view_.reset(view); | 41 cocoa_view_.reset(view); |
| 42 } | 42 } |
| 43 | 43 |
| 44 RenderWidgetHostView* TabContentsViewMac::CreateViewForWidget( | 44 RenderWidgetHostView* TabContentsViewMac::CreateViewForWidget( |
| 45 RenderWidgetHost* render_widget_host) { | 45 RenderWidgetHost* render_widget_host) { |
| 46 DCHECK(!render_widget_host->view()); | 46 DCHECK(!render_widget_host->view()); |
| 47 RenderWidgetHostViewMac* view = | 47 RenderWidgetHostViewMac* view = |
| 48 new RenderWidgetHostViewMac(render_widget_host); | 48 new RenderWidgetHostViewMac(render_widget_host); |
| 49 | 49 |
| 50 // Fancy layout comes later; for now just make it our size and resize it | 50 // Fancy layout comes later; for now just make it our size and resize it |
| 51 // with us. | 51 // with us. In case there are other siblings of the content area, we want |
| 52 // to make sure the content area is on the bottom so other things draw over |
| 53 // it. |
| 52 NSView* view_view = view->native_view(); | 54 NSView* view_view = view->native_view(); |
| 53 [cocoa_view_.get() addSubview:view_view]; | |
| 54 [view_view setFrame:[cocoa_view_.get() bounds]]; | 55 [view_view setFrame:[cocoa_view_.get() bounds]]; |
| 55 [view_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; | 56 [view_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; |
| 56 | 57 [cocoa_view_.get() addSubview:view_view |
| 58 positioned:NSWindowBelow |
| 59 relativeTo:nil]; |
| 57 return view; | 60 return view; |
| 58 } | 61 } |
| 59 | 62 |
| 60 gfx::NativeView TabContentsViewMac::GetNativeView() const { | 63 gfx::NativeView TabContentsViewMac::GetNativeView() const { |
| 61 return cocoa_view_.get(); | 64 return cocoa_view_.get(); |
| 62 } | 65 } |
| 63 | 66 |
| 64 gfx::NativeView TabContentsViewMac::GetContentNativeView() const { | 67 gfx::NativeView TabContentsViewMac::GetContentNativeView() const { |
| 65 if (!tab_contents()->render_widget_host_view()) | 68 if (!tab_contents()->render_widget_host_view()) |
| 66 return NULL; | 69 return NULL; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 277 } |
| 275 | 278 |
| 276 - (void)paste:(id)sender { | 279 - (void)paste:(id)sender { |
| 277 TabContentsView_->tab_contents()->Paste(); | 280 TabContentsView_->tab_contents()->Paste(); |
| 278 } | 281 } |
| 279 | 282 |
| 280 // Tons of stuff goes here, where we grab events going on in Cocoaland and send | 283 // Tons of stuff goes here, where we grab events going on in Cocoaland and send |
| 281 // them into the C++ system. TODO(avi): all that jazz | 284 // them into the C++ system. TODO(avi): all that jazz |
| 282 | 285 |
| 283 @end | 286 @end |
| OLD | NEW |