| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 Frame* selectedFrame = r.innerNonSharedNode()->document()->frame(); | 150 Frame* selectedFrame = r.innerNonSharedNode()->document()->frame(); |
| 151 | 151 |
| 152 WebContextMenuData data; | 152 WebContextMenuData data; |
| 153 data.mousePosition = selectedFrame->view()->contentsToWindow(r.point()); | 153 data.mousePosition = selectedFrame->view()->contentsToWindow(r.point()); |
| 154 | 154 |
| 155 // Links, Images, Media tags, and Image/Media-Links take preference over | 155 // Links, Images, Media tags, and Image/Media-Links take preference over |
| 156 // all else. | 156 // all else. |
| 157 data.linkURL = r.absoluteLinkURL(); | 157 data.linkURL = r.absoluteLinkURL(); |
| 158 | 158 |
| 159 data.mediaType = WebContextMenuData::MediaTypeNone; | 159 data.mediaType = WebContextMenuData::MediaTypeNone; |
| 160 data.mediaFlags = WebContextMenuData::MediaNone; |
| 160 | 161 |
| 161 if (!r.absoluteImageURL().isEmpty()) { | 162 if (!r.absoluteImageURL().isEmpty()) { |
| 162 data.srcURL = r.absoluteImageURL(); | 163 data.srcURL = r.absoluteImageURL(); |
| 163 data.mediaType = WebContextMenuData::MediaTypeImage; | 164 data.mediaType = WebContextMenuData::MediaTypeImage; |
| 164 } else if (!r.absoluteMediaURL().isEmpty()) { | 165 } else if (!r.absoluteMediaURL().isEmpty()) { |
| 165 data.srcURL = r.absoluteMediaURL(); | 166 data.srcURL = r.absoluteMediaURL(); |
| 166 | 167 |
| 167 // We know that if absoluteMediaURL() is not empty, then this | 168 // We know that if absoluteMediaURL() is not empty, then this |
| 168 // is a media element. | 169 // is a media element. |
| 169 HTMLMediaElement* mediaElement = | 170 HTMLMediaElement* mediaElement = |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 data.editFlags |= WebContextMenuData::CanSelectAll; | 232 data.editFlags |= WebContextMenuData::CanSelectAll; |
| 232 | 233 |
| 233 WebFrame* selected_web_frame = WebFrameImpl::FromFrame(selectedFrame); | 234 WebFrame* selected_web_frame = WebFrameImpl::FromFrame(selectedFrame); |
| 234 if (m_webView->client()) | 235 if (m_webView->client()) |
| 235 m_webView->client()->showContextMenu(selected_web_frame, data); | 236 m_webView->client()->showContextMenu(selected_web_frame, data); |
| 236 | 237 |
| 237 return 0; | 238 return 0; |
| 238 } | 239 } |
| 239 | 240 |
| 240 } // namespace WebKit | 241 } // namespace WebKit |
| OLD | NEW |