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

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

Issue 334243004: Use suggested filename for "Save Link As" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | public/web/WebContextMenuData.h » ('j') | public/web/WebContextMenuData.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25 matching lines...) Expand all
36 #include "bindings/v8/ExceptionStatePlaceholder.h" 36 #include "bindings/v8/ExceptionStatePlaceholder.h"
37 #include "core/css/CSSStyleDeclaration.h" 37 #include "core/css/CSSStyleDeclaration.h"
38 #include "core/dom/Document.h" 38 #include "core/dom/Document.h"
39 #include "core/dom/DocumentMarkerController.h" 39 #include "core/dom/DocumentMarkerController.h"
40 #include "core/editing/Editor.h" 40 #include "core/editing/Editor.h"
41 #include "core/editing/SpellChecker.h" 41 #include "core/editing/SpellChecker.h"
42 #include "core/frame/FrameHost.h" 42 #include "core/frame/FrameHost.h"
43 #include "core/frame/FrameView.h" 43 #include "core/frame/FrameView.h"
44 #include "core/frame/PinchViewport.h" 44 #include "core/frame/PinchViewport.h"
45 #include "core/frame/Settings.h" 45 #include "core/frame/Settings.h"
46 #include "core/html/HTMLAnchorElement.h"
46 #include "core/html/HTMLFormElement.h" 47 #include "core/html/HTMLFormElement.h"
47 #include "core/html/HTMLInputElement.h" 48 #include "core/html/HTMLInputElement.h"
48 #include "core/html/HTMLMediaElement.h" 49 #include "core/html/HTMLMediaElement.h"
49 #include "core/html/HTMLPlugInElement.h" 50 #include "core/html/HTMLPlugInElement.h"
50 #include "core/html/MediaError.h" 51 #include "core/html/MediaError.h"
51 #include "core/loader/DocumentLoader.h" 52 #include "core/loader/DocumentLoader.h"
52 #include "core/loader/FrameLoader.h" 53 #include "core/loader/FrameLoader.h"
53 #include "core/loader/HistoryItem.h" 54 #include "core/loader/HistoryItem.h"
54 #include "core/page/ContextMenuController.h" 55 #include "core/page/ContextMenuController.h"
55 #include "core/page/EventHandler.h" 56 #include "core/page/EventHandler.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 DocumentLoader* dl = selectedFrame->loader().documentLoader(); 365 DocumentLoader* dl = selectedFrame->loader().documentLoader();
365 WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl); 366 WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl);
366 if (ds) 367 if (ds)
367 data.securityInfo = ds->response().securityInfo(); 368 data.securityInfo = ds->response().securityInfo();
368 369
369 data.referrerPolicy = static_cast<WebReferrerPolicy>(selectedFrame->document ()->referrerPolicy()); 370 data.referrerPolicy = static_cast<WebReferrerPolicy>(selectedFrame->document ()->referrerPolicy());
370 371
371 // Filter out custom menu elements and add them into the data. 372 // Filter out custom menu elements and add them into the data.
372 populateCustomMenuItems(defaultMenu, &data); 373 populateCustomMenuItems(defaultMenu, &data);
373 374
375 // Extract suggested filename for saving file
Inactive 2014/06/18 12:37:54 nit: please end comments with a period '.'
Nikhil 2014/06/18 13:51:33 Done.
376 if (isHTMLAnchorElement(r.URLElement())) {
377 HTMLAnchorElement* anchor = toHTMLAnchorElement(r.URLElement());
378 data.suggestedFilename = anchor->fastGetAttribute(HTMLNames::downloadAtt r);
379 }
380
374 data.node = r.innerNonSharedNode(); 381 data.node = r.innerNonSharedNode();
375 382
376 WebLocalFrameImpl* selectedWebFrame = WebLocalFrameImpl::fromFrame(selectedF rame); 383 WebLocalFrameImpl* selectedWebFrame = WebLocalFrameImpl::fromFrame(selectedF rame);
377 if (selectedWebFrame->client()) 384 if (selectedWebFrame->client())
378 selectedWebFrame->client()->showContextMenu(data); 385 selectedWebFrame->client()->showContextMenu(data);
379 } 386 }
380 387
381 void ContextMenuClientImpl::clearContextMenu() 388 void ContextMenuClientImpl::clearContextMenu()
382 { 389 {
383 HitTestResult r = m_webView->page()->contextMenuController().hitTestResult() ; 390 HitTestResult r = m_webView->page()->contextMenuController().hitTestResult() ;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 outputItems[i] = subItems[i]; 433 outputItems[i] = subItems[i];
427 subMenuItems.swap(outputItems); 434 subMenuItems.swap(outputItems);
428 } 435 }
429 436
430 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data) 437 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data)
431 { 438 {
432 populateSubMenuItems(defaultMenu->items(), data->customItems); 439 populateSubMenuItems(defaultMenu->items(), data->customItems);
433 } 440 }
434 441
435 } // namespace blink 442 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | public/web/WebContextMenuData.h » ('j') | public/web/WebContextMenuData.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698