OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "chrome/browser/ui/app_modal_dialogs/chrome_javascript_native_dialog_fa ctory.h" | |
6 | |
7 #include "components/app_modal_dialogs/javascript_dialog_manager.h" | |
8 #include "components/app_modal_dialogs/javascript_native_dialog_factory.h" | |
9 #include "components/constrained_window/constrained_window_views.h" | |
10 | |
11 #if defined(USE_X11) && !defined(OS_CHROMEOS) | |
12 #include "chrome/browser/ui/views/javascript_app_modal_dialog_views_x11.h" | |
13 #else | |
14 #include "components/app_modal_dialogs/views/javascript_app_modal_dialog_views.h " | |
15 #endif | |
16 | |
17 namespace { | |
18 | |
19 class ChromeJavaScriptNativeDialogViewsFactory | |
20 : public JavaScriptNativeDialogFactory { | |
21 public: | |
22 ChromeJavaScriptNativeDialogViewsFactory() {} | |
23 ~ChromeJavaScriptNativeDialogViewsFactory() override {} | |
24 | |
25 private: | |
26 NativeAppModalDialog* CreateNativeJavaScriptDialog( | |
27 JavaScriptAppModalDialog* dialog, | |
28 gfx::NativeWindow parent_window) override{ | |
29 JavaScriptAppModalDialogViews* d = | |
msw
2014/11/05 22:59:06
nit: it'd be slightly cleaner to do "d = nullptr;"
oshima
2014/11/05 23:22:49
Done.
| |
30 #if defined(USE_X11) && !defined(OS_CHROMEOS) | |
31 new JavaScriptAppModalDialogViewsX11(dialog); | |
32 #else | |
33 new JavaScriptAppModalDialogViews(dialog); | |
34 #endif | |
35 CreateBrowserModalDialogViews(d, parent_window); | |
36 return d; | |
37 } | |
38 | |
39 DISALLOW_COPY_AND_ASSIGN(ChromeJavaScriptNativeDialogViewsFactory); | |
40 }; | |
41 | |
42 } // namespace | |
43 | |
44 void InstallChromeJavaScriptNativeDialogFactory() { | |
45 SetJavaScriptNativeDialogFactory( | |
46 make_scoped_ptr(new ChromeJavaScriptNativeDialogViewsFactory)); | |
47 } | |
OLD | NEW |