| 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 #import "content/browser/web_contents/web_contents_view_mac.h" | 7 #import "content/browser/web_contents/web_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 if (reverse) { | 262 if (reverse) { |
| 263 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()]; | 263 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()]; |
| 264 } else { | 264 } else { |
| 265 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()]; | 265 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()]; |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 void WebContentsViewMac::CreateNewWindow( | 269 void WebContentsViewMac::CreateNewWindow( |
| 270 int route_id, | 270 int route_id, |
| 271 const ViewHostMsg_CreateWindow_Params& params) { | 271 const ViewHostMsg_CreateWindow_Params& params) { |
| 272 tab_contents_view_helper_.CreateNewWindow(web_contents_, route_id, params); | 272 web_contents_view_helper_.CreateNewWindow(web_contents_, route_id, params); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void WebContentsViewMac::CreateNewWidget( | 275 void WebContentsViewMac::CreateNewWidget( |
| 276 int route_id, WebKit::WebPopupType popup_type) { | 276 int route_id, WebKit::WebPopupType popup_type) { |
| 277 RenderWidgetHostView* widget_view = | 277 RenderWidgetHostView* widget_view = |
| 278 tab_contents_view_helper_.CreateNewWidget(web_contents_, | 278 web_contents_view_helper_.CreateNewWidget(web_contents_, |
| 279 route_id, | 279 route_id, |
| 280 false, | 280 false, |
| 281 popup_type); | 281 popup_type); |
| 282 | 282 |
| 283 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it | 283 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it |
| 284 // to allow it to survive the trip without being hosted. | 284 // to allow it to survive the trip without being hosted. |
| 285 RenderWidgetHostViewMac* widget_view_mac = | 285 RenderWidgetHostViewMac* widget_view_mac = |
| 286 static_cast<RenderWidgetHostViewMac*>(widget_view); | 286 static_cast<RenderWidgetHostViewMac*>(widget_view); |
| 287 [widget_view_mac->GetNativeView() retain]; | 287 [widget_view_mac->GetNativeView() retain]; |
| 288 } | 288 } |
| 289 | 289 |
| 290 void WebContentsViewMac::CreateNewFullscreenWidget(int route_id) { | 290 void WebContentsViewMac::CreateNewFullscreenWidget(int route_id) { |
| 291 RenderWidgetHostView* widget_view = | 291 RenderWidgetHostView* widget_view = |
| 292 tab_contents_view_helper_.CreateNewWidget(web_contents_, | 292 web_contents_view_helper_.CreateNewWidget(web_contents_, |
| 293 route_id, | 293 route_id, |
| 294 true, | 294 true, |
| 295 WebKit::WebPopupTypeNone); | 295 WebKit::WebPopupTypeNone); |
| 296 | 296 |
| 297 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it | 297 // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it |
| 298 // to allow it to survive the trip without being hosted. | 298 // to allow it to survive the trip without being hosted. |
| 299 RenderWidgetHostViewMac* widget_view_mac = | 299 RenderWidgetHostViewMac* widget_view_mac = |
| 300 static_cast<RenderWidgetHostViewMac*>(widget_view); | 300 static_cast<RenderWidgetHostViewMac*>(widget_view); |
| 301 [widget_view_mac->GetNativeView() retain]; | 301 [widget_view_mac->GetNativeView() retain]; |
| 302 } | 302 } |
| 303 | 303 |
| 304 void WebContentsViewMac::ShowCreatedWindow(int route_id, | 304 void WebContentsViewMac::ShowCreatedWindow(int route_id, |
| 305 WindowOpenDisposition disposition, | 305 WindowOpenDisposition disposition, |
| 306 const gfx::Rect& initial_pos, | 306 const gfx::Rect& initial_pos, |
| 307 bool user_gesture) { | 307 bool user_gesture) { |
| 308 tab_contents_view_helper_.ShowCreatedWindow( | 308 web_contents_view_helper_.ShowCreatedWindow( |
| 309 web_contents_, route_id, disposition, initial_pos, user_gesture); | 309 web_contents_, route_id, disposition, initial_pos, user_gesture); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void WebContentsViewMac::ShowCreatedWidget( | 312 void WebContentsViewMac::ShowCreatedWidget( |
| 313 int route_id, const gfx::Rect& initial_pos) { | 313 int route_id, const gfx::Rect& initial_pos) { |
| 314 RenderWidgetHostView* widget_host_view = | 314 RenderWidgetHostView* widget_host_view = |
| 315 tab_contents_view_helper_.ShowCreatedWidget(web_contents_, | 315 web_contents_view_helper_.ShowCreatedWidget(web_contents_, |
| 316 route_id, | 316 route_id, |
| 317 false, | 317 false, |
| 318 initial_pos); | 318 initial_pos); |
| 319 | 319 |
| 320 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's | 320 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's |
| 321 // properly embedded (or purposefully ignored) we can release the retain we | 321 // properly embedded (or purposefully ignored) we can release the retain we |
| 322 // took in CreateNewWidgetInternal(). | 322 // took in CreateNewWidgetInternal(). |
| 323 RenderWidgetHostViewMac* widget_view_mac = | 323 RenderWidgetHostViewMac* widget_view_mac = |
| 324 static_cast<RenderWidgetHostViewMac*>(widget_host_view); | 324 static_cast<RenderWidgetHostViewMac*>(widget_host_view); |
| 325 [widget_view_mac->GetNativeView() release]; | 325 [widget_view_mac->GetNativeView() release]; |
| 326 } | 326 } |
| 327 | 327 |
| 328 void WebContentsViewMac::ShowCreatedFullscreenWidget(int route_id) { | 328 void WebContentsViewMac::ShowCreatedFullscreenWidget(int route_id) { |
| 329 RenderWidgetHostView* widget_host_view = | 329 RenderWidgetHostView* widget_host_view = |
| 330 tab_contents_view_helper_.ShowCreatedWidget(web_contents_, | 330 web_contents_view_helper_.ShowCreatedWidget(web_contents_, |
| 331 route_id, | 331 route_id, |
| 332 true, | 332 true, |
| 333 gfx::Rect()); | 333 gfx::Rect()); |
| 334 | 334 |
| 335 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's | 335 // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's |
| 336 // properly embedded (or purposely ignored) we can release the retain we took | 336 // properly embedded (or purposely ignored) we can release the retain we took |
| 337 // in CreateNewFullscreenWidgetInternal(). | 337 // in CreateNewFullscreenWidgetInternal(). |
| 338 RenderWidgetHostViewMac* widget_view_mac = | 338 RenderWidgetHostViewMac* widget_view_mac = |
| 339 static_cast<RenderWidgetHostViewMac*>(widget_host_view); | 339 static_cast<RenderWidgetHostViewMac*>(widget_host_view); |
| 340 [widget_view_mac->GetNativeView() release]; | 340 [widget_view_mac->GetNativeView() release]; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 [[[notification userInfo] objectForKey:kSelectionDirection] | 574 [[[notification userInfo] objectForKey:kSelectionDirection] |
| 575 unsignedIntegerValue]; | 575 unsignedIntegerValue]; |
| 576 if (direction == NSDirectSelection) | 576 if (direction == NSDirectSelection) |
| 577 return; | 577 return; |
| 578 | 578 |
| 579 [self webContents]-> | 579 [self webContents]-> |
| 580 FocusThroughTabTraversal(direction == NSSelectingPrevious); | 580 FocusThroughTabTraversal(direction == NSSelectingPrevious); |
| 581 } | 581 } |
| 582 | 582 |
| 583 @end | 583 @end |
| OLD | NEW |