1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
7 #include "chrome/browser/platform_util.h"
8 #include "chrome/browser/ui/browser_finder.h"
9 #include "components/web_modal/web_contents_modal_dialog_host.h"
13 class ChromeConstrainedWindowViewsClient
14 : public constrained_window::ConstrainedWindowViewsClient
{
16 ChromeConstrainedWindowViewsClient() {}
17 ~ChromeConstrainedWindowViewsClient() override
{}
20 // ConstrainedWindowViewsClient:
21 web_modal::ModalDialogHost
* GetModalDialogHost(
22 gfx::NativeWindow parent
) override
{
23 // Get the browser dialog management and hosting components from |parent|.
24 Browser
* browser
= chrome::FindBrowserWithWindow(parent
);
26 ChromeWebModalDialogManagerDelegate
* manager
= browser
;
27 return manager
->GetWebContentsModalDialogHost();
31 gfx::NativeView
GetDialogHostView(gfx::NativeWindow parent
) override
{
32 return platform_util::GetViewForWindow(parent
);
35 DISALLOW_COPY_AND_ASSIGN(ChromeConstrainedWindowViewsClient
);
40 scoped_ptr
<constrained_window::ConstrainedWindowViewsClient
>
41 CreateChromeConstrainedWindowViewsClient() {
42 return make_scoped_ptr(new ChromeConstrainedWindowViewsClient
);