| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 int route_id, | 141 int route_id, |
| 142 bool activatable) { | 142 bool activatable) { |
| 143 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it | 143 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it |
| 144 // to allow it to survive the trip without being hosted. | 144 // to allow it to survive the trip without being hosted. |
| 145 RenderWidgetHostView* widget_view = | 145 RenderWidgetHostView* widget_view = |
| 146 TabContentsView::CreateNewWidgetInternal(route_id, activatable); | 146 TabContentsView::CreateNewWidgetInternal(route_id, activatable); |
| 147 RenderWidgetHostViewMac* widget_view_mac = | 147 RenderWidgetHostViewMac* widget_view_mac = |
| 148 static_cast<RenderWidgetHostViewMac*>(widget_view); | 148 static_cast<RenderWidgetHostViewMac*>(widget_view); |
| 149 [widget_view_mac->native_view() retain]; | 149 [widget_view_mac->native_view() retain]; |
| 150 | 150 |
| 151 // |widget_view_mac| needs to know how to position itself in our view. |
| 152 widget_view_mac->set_parent_view(cocoa_view_); |
| 153 |
| 151 return widget_view; | 154 return widget_view; |
| 152 } | 155 } |
| 153 | 156 |
| 154 void TabContentsViewMac::ShowCreatedWidgetInternal( | 157 void TabContentsViewMac::ShowCreatedWidgetInternal( |
| 155 RenderWidgetHostView* widget_host_view, | 158 RenderWidgetHostView* widget_host_view, |
| 156 const gfx::Rect& initial_pos) { | 159 const gfx::Rect& initial_pos) { |
| 157 TabContentsView::ShowCreatedWidgetInternal(widget_host_view, initial_pos); | 160 TabContentsView::ShowCreatedWidgetInternal(widget_host_view, initial_pos); |
| 158 | 161 |
| 159 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's | 162 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's |
| 160 // properly embedded (or purposefully ignored) we can release the retain we | 163 // properly embedded (or purposefully ignored) we can release the retain we |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 234 } |
| 232 | 235 |
| 233 - (void)paste:(id)sender { | 236 - (void)paste:(id)sender { |
| 234 TabContentsView_->web_contents()->Paste(); | 237 TabContentsView_->web_contents()->Paste(); |
| 235 } | 238 } |
| 236 | 239 |
| 237 // Tons of stuff goes here, where we grab events going on in Cocoaland and send | 240 // Tons of stuff goes here, where we grab events going on in Cocoaland and send |
| 238 // them into the C++ system. TODO(avi): all that jazz | 241 // them into the C++ system. TODO(avi): all that jazz |
| 239 | 242 |
| 240 @end | 243 @end |
| OLD | NEW |