| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 if (reverse) { | 265 if (reverse) { |
| 266 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()]; | 266 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()]; |
| 267 } else { | 267 } else { |
| 268 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()]; | 268 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()]; |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 void TabContentsViewMac::CreateNewWindow( | 272 void TabContentsViewMac::CreateNewWindow( |
| 273 int route_id, | 273 int route_id, |
| 274 const ViewHostMsg_CreateWindow_Params& params) { | 274 const ViewHostMsg_CreateWindow_Params& params) { |
| 275 delegate_view_helper_.CreateNewWindow(tab_contents_, route_id, params); | 275 tab_contents_view_helper_.CreateNewWindow(tab_contents_, route_id, params); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void TabContentsViewMac::CreateNewWidget( | 278 void TabContentsViewMac::CreateNewWidget( |
| 279 int route_id, WebKit::WebPopupType popup_type) { | 279 int route_id, WebKit::WebPopupType popup_type) { |
| 280 RenderWidgetHostView* widget_view = | 280 RenderWidgetHostView* widget_view = |
| 281 delegate_view_helper_.CreateNewWidget(tab_contents_, | 281 tab_contents_view_helper_.CreateNewWidget(tab_contents_, |
| 282 route_id, | 282 route_id, |
| 283 false, | 283 false, |
| 284 popup_type); | 284 popup_type); |
| 285 | 285 |
| 286 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it | 286 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it |
| 287 // to allow it to survive the trip without being hosted. | 287 // to allow it to survive the trip without being hosted. |
| 288 RenderWidgetHostViewMac* widget_view_mac = | 288 RenderWidgetHostViewMac* widget_view_mac = |
| 289 static_cast<RenderWidgetHostViewMac*>(widget_view); | 289 static_cast<RenderWidgetHostViewMac*>(widget_view); |
| 290 [widget_view_mac->native_view() retain]; | 290 [widget_view_mac->native_view() retain]; |
| 291 } | 291 } |
| 292 | 292 |
| 293 void TabContentsViewMac::CreateNewFullscreenWidget(int route_id) { | 293 void TabContentsViewMac::CreateNewFullscreenWidget(int route_id) { |
| 294 RenderWidgetHostView* widget_view = | 294 RenderWidgetHostView* widget_view = |
| 295 delegate_view_helper_.CreateNewWidget(tab_contents_, | 295 tab_contents_view_helper_.CreateNewWidget(tab_contents_, |
| 296 route_id, | 296 route_id, |
| 297 true, | 297 true, |
| 298 WebKit::WebPopupTypeNone); | 298 WebKit::WebPopupTypeNone); |
| 299 | 299 |
| 300 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it | 300 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it |
| 301 // to allow it to survive the trip without being hosted. | 301 // to allow it to survive the trip without being hosted. |
| 302 RenderWidgetHostViewMac* widget_view_mac = | 302 RenderWidgetHostViewMac* widget_view_mac = |
| 303 static_cast<RenderWidgetHostViewMac*>(widget_view); | 303 static_cast<RenderWidgetHostViewMac*>(widget_view); |
| 304 [widget_view_mac->native_view() retain]; | 304 [widget_view_mac->native_view() retain]; |
| 305 } | 305 } |
| 306 | 306 |
| 307 void TabContentsViewMac::ShowCreatedWindow(int route_id, | 307 void TabContentsViewMac::ShowCreatedWindow(int route_id, |
| 308 WindowOpenDisposition disposition, | 308 WindowOpenDisposition disposition, |
| 309 const gfx::Rect& initial_pos, | 309 const gfx::Rect& initial_pos, |
| 310 bool user_gesture) { | 310 bool user_gesture) { |
| 311 delegate_view_helper_.ShowCreatedWindow( | 311 tab_contents_view_helper_.ShowCreatedWindow( |
| 312 tab_contents_, route_id, disposition, initial_pos, user_gesture); | 312 tab_contents_, route_id, disposition, initial_pos, user_gesture); |
| 313 } | 313 } |
| 314 | 314 |
| 315 void TabContentsViewMac::ShowCreatedWidget( | 315 void TabContentsViewMac::ShowCreatedWidget( |
| 316 int route_id, const gfx::Rect& initial_pos) { | 316 int route_id, const gfx::Rect& initial_pos) { |
| 317 RenderWidgetHostView* widget_host_view = | 317 RenderWidgetHostView* widget_host_view = |
| 318 delegate_view_helper_.ShowCreatedWidget(tab_contents_, | 318 tab_contents_view_helper_.ShowCreatedWidget(tab_contents_, |
| 319 route_id, | 319 route_id, |
| 320 false, | 320 false, |
| 321 initial_pos); | 321 initial_pos); |
| 322 | 322 |
| 323 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's | 323 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's |
| 324 // properly embedded (or purposefully ignored) we can release the retain we | 324 // properly embedded (or purposefully ignored) we can release the retain we |
| 325 // took in CreateNewWidgetInternal(). | 325 // took in CreateNewWidgetInternal(). |
| 326 RenderWidgetHostViewMac* widget_view_mac = | 326 RenderWidgetHostViewMac* widget_view_mac = |
| 327 static_cast<RenderWidgetHostViewMac*>(widget_host_view); | 327 static_cast<RenderWidgetHostViewMac*>(widget_host_view); |
| 328 [widget_view_mac->native_view() release]; | 328 [widget_view_mac->native_view() release]; |
| 329 } | 329 } |
| 330 | 330 |
| 331 void TabContentsViewMac::ShowCreatedFullscreenWidget(int route_id) { | 331 void TabContentsViewMac::ShowCreatedFullscreenWidget(int route_id) { |
| 332 RenderWidgetHostView* widget_host_view = | 332 RenderWidgetHostView* widget_host_view = |
| 333 delegate_view_helper_.ShowCreatedWidget(tab_contents_, | 333 tab_contents_view_helper_.ShowCreatedWidget(tab_contents_, |
| 334 route_id, | 334 route_id, |
| 335 true, | 335 true, |
| 336 gfx::Rect()); | 336 gfx::Rect()); |
| 337 | 337 |
| 338 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's | 338 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's |
| 339 // properly embedded (or purposely ignored) we can release the retain we took | 339 // properly embedded (or purposely ignored) we can release the retain we took |
| 340 // in CreateNewFullscreenWidgetInternal(). | 340 // in CreateNewFullscreenWidgetInternal(). |
| 341 RenderWidgetHostViewMac* widget_view_mac = | 341 RenderWidgetHostViewMac* widget_view_mac = |
| 342 static_cast<RenderWidgetHostViewMac*>(widget_host_view); | 342 static_cast<RenderWidgetHostViewMac*>(widget_host_view); |
| 343 [widget_view_mac->native_view() release]; | 343 [widget_view_mac->native_view() release]; |
| 344 } | 344 } |
| 345 | 345 |
| 346 void TabContentsViewMac::ShowContextMenu(const ContextMenuParams& params) { | 346 void TabContentsViewMac::ShowContextMenu(const ContextMenuParams& params) { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 [[[notification userInfo] objectForKey:kSelectionDirection] | 612 [[[notification userInfo] objectForKey:kSelectionDirection] |
| 613 unsignedIntegerValue]; | 613 unsignedIntegerValue]; |
| 614 if (direction == NSDirectSelection) | 614 if (direction == NSDirectSelection) |
| 615 return; | 615 return; |
| 616 | 616 |
| 617 [self tabContents]-> | 617 [self tabContents]-> |
| 618 FocusThroughTabTraversal(direction == NSSelectingPrevious); | 618 FocusThroughTabTraversal(direction == NSSelectingPrevious); |
| 619 } | 619 } |
| 620 | 620 |
| 621 @end | 621 @end |
| OLD | NEW |