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

Unified Diff: chrome/browser/download/download_ui_controller.cc

Issue 1840533002: Devtools: Add screenshot button to device mode toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined again Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/download_ui_controller.cc
diff --git a/chrome/browser/download/download_ui_controller.cc b/chrome/browser/download/download_ui_controller.cc
index 2bf05709b85789eb46ca760b34a3ba1d1bc9ddea..5fee080392b41621172f06b917ae1c277643965e 100644
--- a/chrome/browser/download/download_ui_controller.cc
+++ b/chrome/browser/download/download_ui_controller.cc
@@ -9,6 +9,7 @@
#include "base/callback.h"
#include "base/stl_util.h"
#include "build/build_config.h"
+#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_shelf.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -81,6 +82,17 @@ class DownloadShelfUIControllerDelegate
void DownloadShelfUIControllerDelegate::OnNewDownloadReady(
content::DownloadItem* item) {
content::WebContents* web_contents = item->GetWebContents();
+ // For the case of DevTools web contents, we'd like to use target browser
+ // shelf although saving from the DevTools web contents.
+ if (web_contents && DevToolsWindow::IsDevToolsWindow(web_contents)) {
+ DevToolsWindow* devtools_window =
+ DevToolsWindow::AsDevToolsWindow(web_contents);
+ content::WebContents* inspected =
+ devtools_window->GetInspectedWebContents();
+ // Do not overwrite web contents for the case of remote debugging.
+ if (inspected)
+ web_contents = inspected;
+ }
Browser* browser =
web_contents ? chrome::FindBrowserWithWebContents(web_contents) : NULL;
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698