Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 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 28 matching lines...) Expand all Loading... | |
| 39 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
| 40 #include "core/dom/DocumentMarkerController.h" | 40 #include "core/dom/DocumentMarkerController.h" |
| 41 #include "core/editing/Editor.h" | 41 #include "core/editing/Editor.h" |
| 42 #include "core/editing/SpellChecker.h" | 42 #include "core/editing/SpellChecker.h" |
| 43 #include "core/frame/FrameHost.h" | 43 #include "core/frame/FrameHost.h" |
| 44 #include "core/frame/FrameView.h" | 44 #include "core/frame/FrameView.h" |
| 45 #include "core/frame/PinchViewport.h" | 45 #include "core/frame/PinchViewport.h" |
| 46 #include "core/frame/Settings.h" | 46 #include "core/frame/Settings.h" |
| 47 #include "core/html/HTMLAnchorElement.h" | 47 #include "core/html/HTMLAnchorElement.h" |
| 48 #include "core/html/HTMLFormElement.h" | 48 #include "core/html/HTMLFormElement.h" |
| 49 #include "core/html/HTMLImageElement.h" | |
| 49 #include "core/html/HTMLInputElement.h" | 50 #include "core/html/HTMLInputElement.h" |
| 50 #include "core/html/HTMLMediaElement.h" | 51 #include "core/html/HTMLMediaElement.h" |
| 51 #include "core/html/HTMLPlugInElement.h" | 52 #include "core/html/HTMLPlugInElement.h" |
| 52 #include "core/html/MediaError.h" | 53 #include "core/html/MediaError.h" |
| 53 #include "core/layout/HitTestResult.h" | 54 #include "core/layout/HitTestResult.h" |
| 54 #include "core/layout/LayoutPart.h" | 55 #include "core/layout/LayoutPart.h" |
| 55 #include "core/loader/DocumentLoader.h" | 56 #include "core/loader/DocumentLoader.h" |
| 56 #include "core/loader/FrameLoader.h" | 57 #include "core/loader/FrameLoader.h" |
| 57 #include "core/loader/HistoryItem.h" | 58 #include "core/loader/HistoryItem.h" |
| 58 #include "core/page/ContextMenuController.h" | 59 #include "core/page/ContextMenuController.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 data.mediaType = WebContextMenuData::MediaTypeCanvas; | 224 data.mediaType = WebContextMenuData::MediaTypeCanvas; |
| 224 data.hasImageContents = true; | 225 data.hasImageContents = true; |
| 225 } else if (!r.absoluteImageURL().isEmpty()) { | 226 } else if (!r.absoluteImageURL().isEmpty()) { |
| 226 data.srcURL = r.absoluteImageURL(); | 227 data.srcURL = r.absoluteImageURL(); |
| 227 data.mediaType = WebContextMenuData::MediaTypeImage; | 228 data.mediaType = WebContextMenuData::MediaTypeImage; |
| 228 data.mediaFlags |= WebContextMenuData::MediaCanPrint; | 229 data.mediaFlags |= WebContextMenuData::MediaCanPrint; |
| 229 | 230 |
| 230 // An image can be null for many reasons, like being blocked, no image | 231 // An image can be null for many reasons, like being blocked, no image |
| 231 // data received from server yet. | 232 // data received from server yet. |
| 232 data.hasImageContents = r.image() && !r.image()->isNull(); | 233 data.hasImageContents = r.image() && !r.image()->isNull(); |
| 234 if (data.hasImageContents) { | |
| 235 // We know that if absoluteImageURL() is not empty, then this | |
| 236 // is a image element. | |
| 237 HTMLImageElement* imageElement = toHTMLImageElement(r.innerNodeOrIma geMapImage()); | |
| 238 // TODO: Change "via" to "chrome-proxy" once the server starts sendi ng lo-fi responses. | |
| 239 data.imageChromeProxyResponseHeader = imageElement->imageLoader().im age()->response().httpHeaderField("via").utf8().data(); | |
|
Nate Chapin
2015/05/01 18:46:51
What is "via"? It seems wrong to be digging down i
megjablon
2015/05/01 19:15:23
We need a way of telling the context menu that an
| |
| 240 } | |
| 233 } else if (!r.absoluteMediaURL().isEmpty()) { | 241 } else if (!r.absoluteMediaURL().isEmpty()) { |
| 234 data.srcURL = r.absoluteMediaURL(); | 242 data.srcURL = r.absoluteMediaURL(); |
| 235 | 243 |
| 236 // We know that if absoluteMediaURL() is not empty, then this | 244 // We know that if absoluteMediaURL() is not empty, then this |
| 237 // is a media element. | 245 // is a media element. |
| 238 HTMLMediaElement* mediaElement = toHTMLMediaElement(r.innerNode()); | 246 HTMLMediaElement* mediaElement = toHTMLMediaElement(r.innerNode()); |
| 239 if (isHTMLVideoElement(*mediaElement)) | 247 if (isHTMLVideoElement(*mediaElement)) |
| 240 data.mediaType = WebContextMenuData::MediaTypeVideo; | 248 data.mediaType = WebContextMenuData::MediaTypeVideo; |
| 241 else if (isHTMLAudioElement(*mediaElement)) | 249 else if (isHTMLAudioElement(*mediaElement)) |
| 242 data.mediaType = WebContextMenuData::MediaTypeAudio; | 250 data.mediaType = WebContextMenuData::MediaTypeAudio; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 outputItems[i] = subItems[i]; | 443 outputItems[i] = subItems[i]; |
| 436 subMenuItems.swap(outputItems); | 444 subMenuItems.swap(outputItems); |
| 437 } | 445 } |
| 438 | 446 |
| 439 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe nu, WebContextMenuData* data) | 447 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe nu, WebContextMenuData* data) |
| 440 { | 448 { |
| 441 populateSubMenuItems(defaultMenu->items(), data->customItems); | 449 populateSubMenuItems(defaultMenu->items(), data->customItems); |
| 442 } | 450 } |
| 443 | 451 |
| 444 } // namespace blink | 452 } // namespace blink |
| OLD | NEW |