| 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 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/public/browser/render_frame_host.h" |
| 8 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
| 9 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
| 10 #include "content/public/browser/render_widget_host_view.h" | 11 #include "content/public/browser/render_widget_host_view.h" |
| 11 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/browser/web_contents_view.h" | 13 #include "content/public/browser/web_contents_view.h" |
| 13 #include "content/public/common/context_menu_params.h" | 14 #include "content/public/common/context_menu_params.h" |
| 14 #include "content/shell/browser/shell.h" | 15 #include "content/shell/browser/shell.h" |
| 15 #include "content/shell/browser/shell_browser_context.h" | 16 #include "content/shell/browser/shell_browser_context.h" |
| 16 #include "content/shell/browser/shell_browser_main_parts.h" | 17 #include "content/shell/browser/shell_browser_main_parts.h" |
| 17 #include "content/shell/browser/shell_content_browser_client.h" | 18 #include "content/shell/browser/shell_content_browser_client.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 0, | 184 0, |
| 184 web_contents_->GetView()->GetContentNativeView(), | 185 web_contents_->GetView()->GetContentNativeView(), |
| 185 NULL); | 186 NULL); |
| 186 | 187 |
| 187 MenuItemSelected(selection); | 188 MenuItemSelected(selection); |
| 188 #endif | 189 #endif |
| 189 DestroyMenu(menu); | 190 DestroyMenu(menu); |
| 190 } | 191 } |
| 191 | 192 |
| 192 void ShellWebContentsViewDelegate::MenuItemSelected(int selection) { | 193 void ShellWebContentsViewDelegate::MenuItemSelected(int selection) { |
| 194 RenderFrameHost* frame = web_contents_->GetFocusedFrame(); |
| 193 switch (selection) { | 195 switch (selection) { |
| 194 case ShellContextMenuItemCutId: | 196 case ShellContextMenuItemCutId: |
| 195 web_contents_->GetRenderViewHost()->Cut(); | 197 if (frame) |
| 198 frame->Cut(); |
| 196 break; | 199 break; |
| 197 case ShellContextMenuItemCopyId: | 200 case ShellContextMenuItemCopyId: |
| 198 web_contents_->GetRenderViewHost()->Copy(); | 201 if (frame) |
| 202 frame->Copy(); |
| 199 break; | 203 break; |
| 200 case ShellContextMenuItemPasteId: | 204 case ShellContextMenuItemPasteId: |
| 201 web_contents_->GetRenderViewHost()->Paste(); | 205 if (frame) |
| 206 frame->Paste(); |
| 202 break; | 207 break; |
| 203 case ShellContextMenuItemDeleteId: | 208 case ShellContextMenuItemDeleteId: |
| 204 web_contents_->GetRenderViewHost()->Delete(); | 209 web_contents_->GetRenderViewHost()->Delete(); |
| 205 break; | 210 break; |
| 206 case ShellContextMenuItemOpenLinkId: { | 211 case ShellContextMenuItemOpenLinkId: { |
| 207 ShellBrowserContext* browser_context = | 212 ShellBrowserContext* browser_context = |
| 208 ShellContentBrowserClient::Get()->browser_context(); | 213 ShellContentBrowserClient::Get()->browser_context(); |
| 209 Shell::CreateNewWindow(browser_context, | 214 Shell::CreateNewWindow(browser_context, |
| 210 params_.link_url, | 215 params_.link_url, |
| 211 NULL, | 216 NULL, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 return false; | 251 return false; |
| 247 } | 252 } |
| 248 | 253 |
| 249 void ShellWebContentsViewDelegate::TakeFocus(bool reverse) { | 254 void ShellWebContentsViewDelegate::TakeFocus(bool reverse) { |
| 250 } | 255 } |
| 251 | 256 |
| 252 void ShellWebContentsViewDelegate::SizeChanged(const gfx::Size& size) { | 257 void ShellWebContentsViewDelegate::SizeChanged(const gfx::Size& size) { |
| 253 } | 258 } |
| 254 | 259 |
| 255 } // namespace content | 260 } // namespace content |
| OLD | NEW |