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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 data.mediaFlags |= WebContextMenuData::MediaCanSave; | 236 data.mediaFlags |= WebContextMenuData::MediaCanSave; |
237 } | 237 } |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 data.isImageBlocked = | 241 data.isImageBlocked = |
242 (data.mediaType == WebContextMenuData::MediaTypeImage) && !r.image(); | 242 (data.mediaType == WebContextMenuData::MediaTypeImage) && !r.image(); |
243 | 243 |
244 // If it's not a link, an image, a media element, or an image/media link, | 244 // If it's not a link, an image, a media element, or an image/media link, |
245 // show a selection menu or a more generic page menu. | 245 // show a selection menu or a more generic page menu. |
246 data.frameEncoding = selectedFrame->document()->loader()->writer()->encoding
(); | 246 if (selectedFrame->document()->loader()) |
| 247 data.frameEncoding = selectedFrame->document()->loader()->writer()->enco
ding(); |
247 | 248 |
248 // Send the frame and page URLs in any case. | 249 // Send the frame and page URLs in any case. |
249 data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame()); | 250 data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame()); |
250 if (selectedFrame != m_webView->mainFrameImpl()->frame()) { | 251 if (selectedFrame != m_webView->mainFrameImpl()->frame()) { |
251 data.frameURL = urlFromFrame(selectedFrame); | 252 data.frameURL = urlFromFrame(selectedFrame); |
252 RefPtr<HistoryItem> historyItem = selectedFrame->loader()->history()->cu
rrentItem(); | 253 RefPtr<HistoryItem> historyItem = selectedFrame->loader()->history()->cu
rrentItem(); |
253 if (historyItem) | 254 if (historyItem) |
254 data.frameHistoryItem = WebHistoryItem(historyItem); | 255 data.frameHistoryItem = WebHistoryItem(historyItem); |
255 } | 256 } |
256 | 257 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 customItems.append(outputItem); | 347 customItems.append(outputItem); |
347 } | 348 } |
348 | 349 |
349 WebVector<WebMenuItemInfo> outputItems(customItems.size()); | 350 WebVector<WebMenuItemInfo> outputItems(customItems.size()); |
350 for (size_t i = 0; i < customItems.size(); ++i) | 351 for (size_t i = 0; i < customItems.size(); ++i) |
351 outputItems[i] = customItems[i]; | 352 outputItems[i] = customItems[i]; |
352 data->customItems.swap(outputItems); | 353 data->customItems.swap(outputItems); |
353 } | 354 } |
354 | 355 |
355 } // namespace WebKit | 356 } // namespace WebKit |
OLD | NEW |