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

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

Issue 1133003003: Fix copying from interstitial pages on OSX by going through the RenderWidgetHostDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Nasko's comments. Created 5 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_impl.cc ('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 <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <OpenGL/gl.h> 8 #include <OpenGL/gl.h>
9 #include <QuartzCore/QuartzCore.h> 9 #include <QuartzCore/QuartzCore.h>
10 10
(...skipping 20 matching lines...) Expand all
31 #include "content/browser/bad_message.h" 31 #include "content/browser/bad_message.h"
32 #import "content/browser/cocoa/system_hotkey_helper_mac.h" 32 #import "content/browser/cocoa/system_hotkey_helper_mac.h"
33 #import "content/browser/cocoa/system_hotkey_map.h" 33 #import "content/browser/cocoa/system_hotkey_map.h"
34 #include "content/browser/compositor/resize_lock.h" 34 #include "content/browser/compositor/resize_lock.h"
35 #include "content/browser/frame_host/frame_tree.h" 35 #include "content/browser/frame_host/frame_tree.h"
36 #include "content/browser/frame_host/frame_tree_node.h" 36 #include "content/browser/frame_host/frame_tree_node.h"
37 #include "content/browser/frame_host/render_frame_host_impl.h" 37 #include "content/browser/frame_host/render_frame_host_impl.h"
38 #include "content/browser/gpu/compositor_util.h" 38 #include "content/browser/gpu/compositor_util.h"
39 #include "content/browser/renderer_host/render_view_host_impl.h" 39 #include "content/browser/renderer_host/render_view_host_impl.h"
40 #include "content/browser/renderer_host/render_widget_helper.h" 40 #include "content/browser/renderer_host/render_widget_helper.h"
41 #include "content/browser/renderer_host/render_widget_host_delegate.h"
41 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he lper.h" 42 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he lper.h"
42 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h elper.h" 43 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h elper.h"
43 #import "content/browser/renderer_host/text_input_client_mac.h" 44 #import "content/browser/renderer_host/text_input_client_mac.h"
44 #include "content/common/accessibility_messages.h" 45 #include "content/common/accessibility_messages.h"
45 #include "content/common/edit_command.h" 46 #include "content/common/edit_command.h"
46 #include "content/common/gpu/gpu_messages.h" 47 #include "content/common/gpu/gpu_messages.h"
47 #include "content/common/input_messages.h" 48 #include "content/common/input_messages.h"
48 #include "content/common/view_messages.h" 49 #include "content/common/view_messages.h"
49 #include "content/common/webplugin_geometry.h" 50 #include "content/common/webplugin_geometry.h"
50 #include "content/public/browser/browser_context.h" 51 #include "content/public/browser/browser_context.h"
(...skipping 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after
3249 WebMouseEvent event; 3250 WebMouseEvent event;
3250 event.type = WebInputEvent::MouseUp; 3251 event.type = WebInputEvent::MouseUp;
3251 event.button = WebMouseEvent::ButtonLeft; 3252 event.button = WebMouseEvent::ButtonLeft;
3252 renderWidgetHostView_->ForwardMouseEvent(event); 3253 renderWidgetHostView_->ForwardMouseEvent(event);
3253 3254
3254 hasOpenMouseDown_ = NO; 3255 hasOpenMouseDown_ = NO;
3255 } 3256 }
3256 } 3257 }
3257 3258
3258 - (void)undo:(id)sender { 3259 - (void)undo:(id)sender {
3259 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3260 content::RenderWidgetHostDelegate* render_widget_host_delegate =
3260 if (web_contents) 3261 renderWidgetHostView_->render_widget_host_->GetDelegate();
3261 web_contents->Undo(); 3262 if (!render_widget_host_delegate) {
Charlie Reis 2015/05/14 20:36:28 nit: Seems like this would be easier to read, like
3263 return;
3264 }
3265 render_widget_host_delegate->Undo();
3262 } 3266 }
3263 3267
3264 - (void)redo:(id)sender { 3268 - (void)redo:(id)sender {
3265 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3269 content::RenderWidgetHostDelegate* render_widget_host_delegate =
3266 if (web_contents) 3270 renderWidgetHostView_->render_widget_host_->GetDelegate();
3267 web_contents->Redo(); 3271 if (!render_widget_host_delegate) {
3272 return;
3273 }
3274 render_widget_host_delegate->Redo();
3268 } 3275 }
3269 3276
3270 - (void)cut:(id)sender { 3277 - (void)cut:(id)sender {
3271 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3278 content::RenderWidgetHostDelegate* render_widget_host_delegate =
3272 if (web_contents) 3279 renderWidgetHostView_->render_widget_host_->GetDelegate();
3273 web_contents->Cut(); 3280 if (!render_widget_host_delegate) {
3281 return;
3282 }
3283 render_widget_host_delegate->Cut();
3274 } 3284 }
3275 3285
3276 - (void)copy:(id)sender { 3286 - (void)copy:(id)sender {
3277 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3287 content::RenderWidgetHostDelegate* render_widget_host_delegate =
3278 if (web_contents) 3288 renderWidgetHostView_->render_widget_host_->GetDelegate();
3279 web_contents->Copy(); 3289 if (!render_widget_host_delegate) {
3290 return;
3291 }
3292 render_widget_host_delegate->Copy();
3280 } 3293 }
3281 3294
3282 - (void)copyToFindPboard:(id)sender { 3295 - (void)copyToFindPboard:(id)sender {
3283 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3296 content::RenderWidgetHostDelegate* render_widget_host_delegate =
3284 if (web_contents) 3297 renderWidgetHostView_->render_widget_host_->GetDelegate();
3285 web_contents->CopyToFindPboard(); 3298 if (!render_widget_host_delegate) {
3299 return;
3300 }
3301 render_widget_host_delegate->CopyToFindPboard();
3286 } 3302 }
3287 3303
3288 - (void)paste:(id)sender { 3304 - (void)paste:(id)sender {
3289 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3305 content::RenderWidgetHostDelegate* render_widget_host_delegate =
3290 if (web_contents) 3306 renderWidgetHostView_->render_widget_host_->GetDelegate();
3291 web_contents->Paste(); 3307 if (!render_widget_host_delegate) {
3308 return;
3309 }
3310 render_widget_host_delegate->Paste();
3292 } 3311 }
3293 3312
3294 - (void)pasteAndMatchStyle:(id)sender { 3313 - (void)pasteAndMatchStyle:(id)sender {
3295 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3314 content::RenderWidgetHostDelegate* render_widget_host_delegate =
3296 if (web_contents) 3315 renderWidgetHostView_->render_widget_host_->GetDelegate();
3297 web_contents->PasteAndMatchStyle(); 3316 if (!render_widget_host_delegate) {
3317 return;
3318 }
3319 render_widget_host_delegate->PasteAndMatchStyle();
3298 } 3320 }
3299 3321
3300 - (void)selectAll:(id)sender { 3322 - (void)selectAll:(id)sender {
3301 // editCommand_helper_ adds implementations for most NSResponder methods 3323 // editCommand_helper_ adds implementations for most NSResponder methods
3302 // dynamically. But the renderer side only sends selection results back to 3324 // dynamically. But the renderer side only sends selection results back to
3303 // the browser if they were triggered by a keyboard event or went through 3325 // the browser if they were triggered by a keyboard event or went through
3304 // one of the Select methods on RWH. Since selectAll: is called from the 3326 // one of the Select methods on RWH. Since selectAll: is called from the
3305 // menu handler, neither is true. 3327 // menu handler, neither is true.
3306 // Explicitly call SelectAll() here to make sure the renderer returns 3328 // Explicitly call SelectAll() here to make sure the renderer returns
3307 // selection results. 3329 // selection results.
3308 WebContents* web_contents = renderWidgetHostView_->GetWebContents(); 3330 content::RenderWidgetHostDelegate* render_widget_host_delegate =
3309 if (web_contents) 3331 renderWidgetHostView_->render_widget_host_->GetDelegate();
3310 web_contents->SelectAll(); 3332 if (!render_widget_host_delegate) {
3333 return;
3334 }
3335 render_widget_host_delegate->SelectAll();
3311 } 3336 }
3312 3337
3313 - (void)startSpeaking:(id)sender { 3338 - (void)startSpeaking:(id)sender {
3314 GetRenderWidgetHostViewToUse(renderWidgetHostView_.get())->SpeakSelection(); 3339 GetRenderWidgetHostViewToUse(renderWidgetHostView_.get())->SpeakSelection();
3315 } 3340 }
3316 3341
3317 - (void)stopSpeaking:(id)sender { 3342 - (void)stopSpeaking:(id)sender {
3318 GetRenderWidgetHostViewToUse(renderWidgetHostView_.get())->StopSpeaking(); 3343 GetRenderWidgetHostViewToUse(renderWidgetHostView_.get())->StopSpeaking();
3319 } 3344 }
3320 3345
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
3484 3509
3485 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3510 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3486 // regions that are not draggable. (See ControlRegionView in 3511 // regions that are not draggable. (See ControlRegionView in
3487 // native_app_window_cocoa.mm). This requires the render host view to be 3512 // native_app_window_cocoa.mm). This requires the render host view to be
3488 // draggable by default. 3513 // draggable by default.
3489 - (BOOL)mouseDownCanMoveWindow { 3514 - (BOOL)mouseDownCanMoveWindow {
3490 return YES; 3515 return YES;
3491 } 3516 }
3492 3517
3493 @end 3518 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698