Index: chrome/browser/ui/views/chrome_constrained_window_views_client.cc |
diff --git a/chrome/browser/ui/views/chrome_constrained_window_views_client.cc b/chrome/browser/ui/views/chrome_constrained_window_views_client.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..aea31f9736f6b596937eaef9b07a625dbcb1dfea |
--- /dev/null |
+++ b/chrome/browser/ui/views/chrome_constrained_window_views_client.cc |
@@ -0,0 +1,47 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
+ |
+#include "chrome/browser/ui/browser_finder.h" |
+#include "components/web_modal/web_contents_modal_dialog_host.h" |
+#include "extensions/browser/guest_view/guest_view_base.h" |
+ |
+namespace { |
+ |
+class ChromeConstrainedWindowViewsClient |
+ : public ConstrainedWindowViewsClient { |
+ public: |
+ ChromeConstrainedWindowViewsClient() {} |
+ ~ChromeConstrainedWindowViewsClient() override {} |
+ |
+ private: |
+ // ConstrainedWindowViewsClient: |
+ content::WebContents* GetEmbedderWebContents( |
+ content::WebContents* initiator_web_contents) override { |
+ extensions::GuestViewBase* guest_view = |
+ extensions::GuestViewBase::FromWebContents(initiator_web_contents); |
+ return guest_view && guest_view->embedder_web_contents() ? |
+ guest_view->embedder_web_contents() : initiator_web_contents; |
+ } |
+ web_modal::ModalDialogHost* GetModalDialogHost( |
+ gfx::NativeWindow parent) override { |
+ // Get the browser dialog management and hosting components from |parent|. |
+ Browser* browser = chrome::FindBrowserWithWindow(parent); |
+ if (browser) { |
+ ChromeWebModalDialogManagerDelegate* manager = browser; |
+ return manager->GetWebContentsModalDialogHost(); |
+ } |
+ return nullptr; |
+ } |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ChromeConstrainedWindowViewsClient); |
+}; |
+ |
+} // namespace |
+ |
+scoped_ptr<ConstrainedWindowViewsClient> |
+CreateChromeConstrainedWindowViewsClient() { |
+ return make_scoped_ptr(new ChromeConstrainedWindowViewsClient); |
+} |