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

Side by Side Diff: Source/web/ContextMenuClientImpl.cpp

Issue 1112513005: Reload image bypassing the cache (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: japhet 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
OLDNEW
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
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"
59 #include "core/page/EventHandler.h" 60 #include "core/page/EventHandler.h"
60 #include "core/page/Page.h" 61 #include "core/page/Page.h"
61 #include "platform/ContextMenu.h" 62 #include "platform/ContextMenu.h"
62 #include "platform/Widget.h" 63 #include "platform/Widget.h"
64 #include "platform/exported/WrappedResourceResponse.h"
63 #include "platform/text/TextBreakIterator.h" 65 #include "platform/text/TextBreakIterator.h"
64 #include "platform/weborigin/KURL.h" 66 #include "platform/weborigin/KURL.h"
65 #include "public/platform/WebPoint.h" 67 #include "public/platform/WebPoint.h"
66 #include "public/platform/WebString.h" 68 #include "public/platform/WebString.h"
67 #include "public/platform/WebURL.h" 69 #include "public/platform/WebURL.h"
68 #include "public/platform/WebURLResponse.h" 70 #include "public/platform/WebURLResponse.h"
69 #include "public/platform/WebVector.h" 71 #include "public/platform/WebVector.h"
70 #include "public/web/WebContextMenuData.h" 72 #include "public/web/WebContextMenuData.h"
71 #include "public/web/WebFormElement.h" 73 #include "public/web/WebFormElement.h"
72 #include "public/web/WebFrameClient.h" 74 #include "public/web/WebFrameClient.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 data.mediaType = WebContextMenuData::MediaTypeCanvas; 225 data.mediaType = WebContextMenuData::MediaTypeCanvas;
224 data.hasImageContents = true; 226 data.hasImageContents = true;
225 } else if (!r.absoluteImageURL().isEmpty()) { 227 } else if (!r.absoluteImageURL().isEmpty()) {
226 data.srcURL = r.absoluteImageURL(); 228 data.srcURL = r.absoluteImageURL();
227 data.mediaType = WebContextMenuData::MediaTypeImage; 229 data.mediaType = WebContextMenuData::MediaTypeImage;
228 data.mediaFlags |= WebContextMenuData::MediaCanPrint; 230 data.mediaFlags |= WebContextMenuData::MediaCanPrint;
229 231
230 // An image can be null for many reasons, like being blocked, no image 232 // An image can be null for many reasons, like being blocked, no image
231 // data received from server yet. 233 // data received from server yet.
232 data.hasImageContents = r.image() && !r.image()->isNull(); 234 data.hasImageContents = r.image() && !r.image()->isNull();
235 if (data.hasImageContents) {
236 HTMLImageElement* imageElement = toHTMLImageElement(r.innerNodeOrIma geMapImage());
237 if (imageElement && imageElement->cachedImage())
238 data.imageResponseExtraData = WrappedResourceResponse(imageEleme nt->cachedImage()->response()).extraData();
239 }
233 } else if (!r.absoluteMediaURL().isEmpty()) { 240 } else if (!r.absoluteMediaURL().isEmpty()) {
234 data.srcURL = r.absoluteMediaURL(); 241 data.srcURL = r.absoluteMediaURL();
235 242
236 // We know that if absoluteMediaURL() is not empty, then this 243 // We know that if absoluteMediaURL() is not empty, then this
237 // is a media element. 244 // is a media element.
238 HTMLMediaElement* mediaElement = toHTMLMediaElement(r.innerNode()); 245 HTMLMediaElement* mediaElement = toHTMLMediaElement(r.innerNode());
239 if (isHTMLVideoElement(*mediaElement)) 246 if (isHTMLVideoElement(*mediaElement))
240 data.mediaType = WebContextMenuData::MediaTypeVideo; 247 data.mediaType = WebContextMenuData::MediaTypeVideo;
241 else if (isHTMLAudioElement(*mediaElement)) 248 else if (isHTMLAudioElement(*mediaElement))
242 data.mediaType = WebContextMenuData::MediaTypeAudio; 249 data.mediaType = WebContextMenuData::MediaTypeAudio;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 outputItems[i] = subItems[i]; 442 outputItems[i] = subItems[i];
436 subMenuItems.swap(outputItems); 443 subMenuItems.swap(outputItems);
437 } 444 }
438 445
439 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe nu, WebContextMenuData* data) 446 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe nu, WebContextMenuData* data)
440 { 447 {
441 populateSubMenuItems(defaultMenu->items(), data->customItems); 448 populateSubMenuItems(defaultMenu->items(), data->customItems);
442 } 449 }
443 450
444 } // namespace blink 451 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698