Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2878153002: Fixed some edit commands for OOPIF-<webivew> (Mac) (Closed)
Patch Set: Addressing creis@'s comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <objc/runtime.h> 8 #import <objc/runtime.h>
9 #include <OpenGL/gl.h> 9 #include <OpenGL/gl.h>
10 #include <QuartzCore/QuartzCore.h> 10 #include <QuartzCore/QuartzCore.h>
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 // We obtain the TextSelection from focused RWH which is obtained from the 716 // We obtain the TextSelection from focused RWH which is obtained from the
717 // frame tree. BrowserPlugin-based guests' RWH is not part of the frame tree 717 // frame tree. BrowserPlugin-based guests' RWH is not part of the frame tree
718 // and the focused RWH will be that of the embedder which is incorrect. In 718 // and the focused RWH will be that of the embedder which is incorrect. In
719 // this case we should use TextSelection for |this| since RWHV for guest 719 // this case we should use TextSelection for |this| since RWHV for guest
720 // forwards text selection information to its platform view. 720 // forwards text selection information to its platform view.
721 return is_guest_view_hack_ ? this : GetFocusedWidget() 721 return is_guest_view_hack_ ? this : GetFocusedWidget()
722 ? GetFocusedWidget()->GetView() 722 ? GetFocusedWidget()->GetView()
723 : nullptr; 723 : nullptr;
724 } 724 }
725 725
726 RenderWidgetHostDelegate*
727 RenderWidgetHostViewMac::GetFocusedRenderWidgetHostDelegate() {
728 if (auto* focused_widget = GetFocusedWidget())
729 return focused_widget->delegate();
730 return render_widget_host_->delegate();
EhsanK 2017/05/16 04:34:32 We were not checking |render_widget_host_ != nullp
Charlie Reis 2017/05/16 16:24:56 Sounds fine. Thanks!
731 }
732
726 void RenderWidgetHostViewMac::UpdateBackingStoreProperties() { 733 void RenderWidgetHostViewMac::UpdateBackingStoreProperties() {
727 if (!render_widget_host_) 734 if (!render_widget_host_)
728 return; 735 return;
729 render_widget_host_->NotifyScreenInfoChanged(); 736 render_widget_host_->NotifyScreenInfoChanged();
730 } 737 }
731 738
732 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const { 739 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const {
733 return render_widget_host_; 740 return render_widget_host_;
734 } 741 }
735 742
(...skipping 2604 matching lines...) Expand 10 before | Expand all | Expand 10 after
3340 web_contents->Undo(); 3347 web_contents->Undo();
3341 } 3348 }
3342 3349
3343 - (void)redo:(id)sender { 3350 - (void)redo:(id)sender {
3344 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3351 WebContents* web_contents = renderWidgetHostView_->GetWebContents();
3345 if (web_contents) 3352 if (web_contents)
3346 web_contents->Redo(); 3353 web_contents->Redo();
3347 } 3354 }
3348 3355
3349 - (void)cut:(id)sender { 3356 - (void)cut:(id)sender {
3350 content::RenderWidgetHostDelegate* render_widget_host_delegate = 3357 if (auto* delegate =
3351 renderWidgetHostView_->render_widget_host_->delegate(); 3358 renderWidgetHostView_->GetFocusedRenderWidgetHostDelegate()) {
3352 if (render_widget_host_delegate) 3359 delegate->Cut();
3353 render_widget_host_delegate->Cut(); 3360 }
3354 } 3361 }
3355 3362
3356 - (void)copy:(id)sender { 3363 - (void)copy:(id)sender {
3357 content::RenderWidgetHostDelegate* render_widget_host_delegate = 3364 if (auto* delegate =
3358 renderWidgetHostView_->render_widget_host_->delegate(); 3365 renderWidgetHostView_->GetFocusedRenderWidgetHostDelegate()) {
3359 if (render_widget_host_delegate) 3366 delegate->Copy();
3360 render_widget_host_delegate->Copy(); 3367 }
3361 } 3368 }
3362 3369
3363 - (void)copyToFindPboard:(id)sender { 3370 - (void)copyToFindPboard:(id)sender {
3364 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3371 WebContents* web_contents = renderWidgetHostView_->GetWebContents();
3365 if (web_contents) 3372 if (web_contents)
3366 web_contents->CopyToFindPboard(); 3373 web_contents->CopyToFindPboard();
3367 } 3374 }
3368 3375
3369 - (void)paste:(id)sender { 3376 - (void)paste:(id)sender {
3370 content::RenderWidgetHostDelegate* render_widget_host_delegate = 3377 if (auto* delegate =
3371 renderWidgetHostView_->render_widget_host_->delegate(); 3378 renderWidgetHostView_->GetFocusedRenderWidgetHostDelegate()) {
3372 if (render_widget_host_delegate) 3379 delegate->Paste();
3373 render_widget_host_delegate->Paste(); 3380 }
3374 } 3381 }
3375 3382
3376 - (void)pasteAndMatchStyle:(id)sender { 3383 - (void)pasteAndMatchStyle:(id)sender {
3377 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3384 WebContents* web_contents = renderWidgetHostView_->GetWebContents();
3378 if (web_contents) 3385 if (web_contents)
3379 web_contents->PasteAndMatchStyle(); 3386 web_contents->PasteAndMatchStyle();
3380 } 3387 }
3381 3388
3382 - (void)selectAll:(id)sender { 3389 - (void)selectAll:(id)sender {
3383 // editCommand_helper_ adds implementations for most NSResponder methods 3390 // editCommand_helper_ adds implementations for most NSResponder methods
3384 // dynamically. But the renderer side only sends selection results back to 3391 // dynamically. But the renderer side only sends selection results back to
3385 // the browser if they were triggered by a keyboard event or went through 3392 // the browser if they were triggered by a keyboard event or went through
3386 // one of the Select methods on RWH. Since selectAll: is called from the 3393 // one of the Select methods on RWH. Since selectAll: is called from the
3387 // menu handler, neither is true. 3394 // menu handler, neither is true.
3388 // Explicitly call SelectAll() here to make sure the renderer returns 3395 // Explicitly call SelectAll() here to make sure the renderer returns
3389 // selection results. 3396 // selection results.
3390 content::RenderWidgetHostDelegate* render_widget_host_delegate = 3397 if (auto* delegate =
3391 renderWidgetHostView_->render_widget_host_->delegate(); 3398 renderWidgetHostView_->GetFocusedRenderWidgetHostDelegate()) {
3392 if (render_widget_host_delegate) 3399 delegate->SelectAll();
3393 render_widget_host_delegate->SelectAll(); 3400 }
3394 } 3401 }
3395 3402
3396 - (void)startSpeaking:(id)sender { 3403 - (void)startSpeaking:(id)sender {
3397 GetRenderWidgetHostViewToUse(renderWidgetHostView_.get())->SpeakSelection(); 3404 GetRenderWidgetHostViewToUse(renderWidgetHostView_.get())->SpeakSelection();
3398 } 3405 }
3399 3406
3400 - (void)stopSpeaking:(id)sender { 3407 - (void)stopSpeaking:(id)sender {
3401 GetRenderWidgetHostViewToUse(renderWidgetHostView_.get())->StopSpeaking(); 3408 GetRenderWidgetHostViewToUse(renderWidgetHostView_.get())->StopSpeaking();
3402 } 3409 }
3403 3410
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
3503 3510
3504 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3511 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3505 // regions that are not draggable. (See ControlRegionView in 3512 // regions that are not draggable. (See ControlRegionView in
3506 // native_app_window_cocoa.mm). This requires the render host view to be 3513 // native_app_window_cocoa.mm). This requires the render host view to be
3507 // draggable by default. 3514 // draggable by default.
3508 - (BOOL)mouseDownCanMoveWindow { 3515 - (BOOL)mouseDownCanMoveWindow {
3509 return YES; 3516 return YES;
3510 } 3517 }
3511 3518
3512 @end 3519 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698