[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / chrome_web_dialog_view.cc
blobc73f6eafe05706917ad25cb37dbe583c12fa0f23
1 // Copyright (c) 2012 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/browser_dialogs.h"
6 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
7 #include "ui/views/controls/webview/web_dialog_view.h"
8 #include "ui/views/widget/widget.h"
10 namespace chrome {
12 // Declared in browser_dialogs.h so that others don't need to depend on our .h.
13 gfx::NativeWindow ShowWebDialog(gfx::NativeWindow parent,
14 content::BrowserContext* context,
15 ui::WebDialogDelegate* delegate) {
16 views::Widget* widget = NULL;
17 if (parent) {
18 widget = views::Widget::CreateWindowWithParent(
19 new views::WebDialogView(context,
20 delegate,
21 new ChromeWebContentsHandler),
22 parent);
23 } else {
24 // We shouldn't be called with a NULL parent, but sometimes are.
25 widget = views::Widget::CreateWindow(
26 new views::WebDialogView(context,
27 delegate,
28 new ChromeWebContentsHandler));
31 widget->Show();
32 return widget->GetNativeWindow();
35 } // namespace chrome