| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shell/browser/shell_web_contents_view_delegate.h" | 5 #include "content/shell/browser/shell_web_contents_view_delegate.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "content/public/browser/render_frame_host.h" |
| 10 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
| 11 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
| 12 #include "content/public/browser/render_widget_host_view.h" | 13 #include "content/public/browser/render_widget_host_view.h" |
| 13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/browser/web_contents_view.h" | 15 #include "content/public/browser/web_contents_view.h" |
| 15 #include "content/public/common/context_menu_params.h" | 16 #include "content/public/common/context_menu_params.h" |
| 16 #include "content/shell/browser/shell.h" | 17 #include "content/shell/browser/shell.h" |
| 17 #include "content/shell/browser/shell_browser_context.h" | 18 #include "content/shell/browser/shell_browser_context.h" |
| 18 #include "content/shell/browser/shell_browser_main_parts.h" | 19 #include "content/shell/browser/shell_browser_main_parts.h" |
| 19 #include "content/shell/browser/shell_content_browser_client.h" | 20 #include "content/shell/browser/shell_content_browser_client.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 eventNumber:0 | 216 eventNumber:0 |
| 216 clickCount:1 | 217 clickCount:1 |
| 217 pressure:1.0]; | 218 pressure:1.0]; |
| 218 | 219 |
| 219 [NSMenu popUpContextMenu:menu | 220 [NSMenu popUpContextMenu:menu |
| 220 withEvent:clickEvent | 221 withEvent:clickEvent |
| 221 forView:parent_view]; | 222 forView:parent_view]; |
| 222 } | 223 } |
| 223 | 224 |
| 224 void ShellWebContentsViewDelegate::ActionPerformed(int tag) { | 225 void ShellWebContentsViewDelegate::ActionPerformed(int tag) { |
| 226 RenderFrameHost* frame = web_contents_->GetFocusedFrame(); |
| 225 switch (tag) { | 227 switch (tag) { |
| 226 case ShellContextMenuItemCutTag: | 228 case ShellContextMenuItemCutTag: |
| 227 web_contents_->GetRenderViewHost()->Cut(); | 229 if (frame) |
| 230 frame->Cut(); |
| 228 break; | 231 break; |
| 229 case ShellContextMenuItemCopyTag: | 232 case ShellContextMenuItemCopyTag: |
| 230 web_contents_->GetRenderViewHost()->Copy(); | 233 if (frame) |
| 234 frame->Copy(); |
| 231 break; | 235 break; |
| 232 case ShellContextMenuItemPasteTag: | 236 case ShellContextMenuItemPasteTag: |
| 233 web_contents_->GetRenderViewHost()->Paste(); | 237 if (frame) |
| 238 frame->Paste(); |
| 234 break; | 239 break; |
| 235 case ShellContextMenuItemDeleteTag: | 240 case ShellContextMenuItemDeleteTag: |
| 236 web_contents_->GetRenderViewHost()->Delete(); | 241 web_contents_->GetRenderViewHost()->Delete(); |
| 237 break; | 242 break; |
| 238 case ShellContextMenuItemOpenLinkTag: { | 243 case ShellContextMenuItemOpenLinkTag: { |
| 239 ShellBrowserContext* browser_context = | 244 ShellBrowserContext* browser_context = |
| 240 ShellContentBrowserClient::Get()->browser_context(); | 245 ShellContentBrowserClient::Get()->browser_context(); |
| 241 Shell::CreateNewWindow(browser_context, | 246 Shell::CreateNewWindow(browser_context, |
| 242 params_.link_url, | 247 params_.link_url, |
| 243 NULL, | 248 NULL, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 269 return NULL; | 274 return NULL; |
| 270 } | 275 } |
| 271 | 276 |
| 272 NSObject<RenderWidgetHostViewMacDelegate>* | 277 NSObject<RenderWidgetHostViewMacDelegate>* |
| 273 ShellWebContentsViewDelegate::CreateRenderWidgetHostViewDelegate( | 278 ShellWebContentsViewDelegate::CreateRenderWidgetHostViewDelegate( |
| 274 content::RenderWidgetHost* render_widget_host) { | 279 content::RenderWidgetHost* render_widget_host) { |
| 275 return NULL; | 280 return NULL; |
| 276 } | 281 } |
| 277 | 282 |
| 278 } // namespace content | 283 } // namespace content |
| OLD | NEW |