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

Unified Diff: chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc

Issue 2428383008: Bug Fix: Desktop Capture Picker Not Modal (Closed)
Patch Set: Comment Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc
diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc b/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc
index 049a56b160d31a5e43666ae27df96f09b104d758..a8d84e19702459dbc01a068a6c32b9ed847aee8d 100644
--- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc
+++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc
@@ -17,6 +17,8 @@
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/webrtc/native_desktop_media_list.h"
#include "chrome/browser/media/webrtc/tab_desktop_media_list.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_window.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -116,8 +118,16 @@ bool DesktopCaptureChooseDesktopMediaFunctionBase::Execute(
return false;
}
- const gfx::NativeWindow parent_window =
- web_contents->GetTopLevelNativeWindow();
+ gfx::NativeWindow parent_window = web_contents->GetTopLevelNativeWindow();
+ // In case of background Javascript, |parent_window| will be null. We are
Sergey Ulanov 2016/10/26 19:19:44 s/of background Javascript/the call comes from a b
qiangchen 2016/10/26 19:42:23 Done.
+ // going to make the picker modal to the current browser window.
+ if (!parent_window) {
+ Browser* target_browser = chrome::FindLastActiveWithProfile(
+ Profile::FromBrowserContext(web_contents->GetBrowserContext()));
+
+ if (target_browser)
+ parent_window = target_browser->window()->GetNativeWindow();
+ }
std::unique_ptr<DesktopMediaList> screen_list;
std::unique_ptr<DesktopMediaList> window_list;
std::unique_ptr<DesktopMediaList> tab_list;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698