OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/app_modal_dialogs/chrome_javascript_native_dialog_fa
ctory.h" | 5 #include "athena/extensions/athena_javascript_native_dialog_factory.h" |
6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" |
7 #include "components/app_modal_dialogs/javascript_dialog_manager.h" | 8 #include "components/app_modal_dialogs/javascript_dialog_manager.h" |
8 #include "components/app_modal_dialogs/javascript_native_dialog_factory.h" | 9 #include "components/app_modal_dialogs/javascript_native_dialog_factory.h" |
| 10 #include "components/app_modal_dialogs/views/javascript_app_modal_dialog_views.h
" |
9 #include "components/constrained_window/constrained_window_views.h" | 11 #include "components/constrained_window/constrained_window_views.h" |
10 | 12 |
11 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 13 class JavaScriptAppModalDialog; |
12 #include "chrome/browser/ui/views/javascript_app_modal_dialog_views_x11.h" | 14 class NativeAppModalDialog; |
13 #else | |
14 #include "components/app_modal_dialogs/views/javascript_app_modal_dialog_views.h
" | |
15 #endif | |
16 | 15 |
| 16 namespace athena { |
17 namespace { | 17 namespace { |
18 | 18 |
19 class ChromeJavaScriptNativeDialogViewsFactory | 19 class AthenaJavaScriptNativeDialogFactory |
20 : public JavaScriptNativeDialogFactory { | 20 : public JavaScriptNativeDialogFactory { |
21 public: | 21 public: |
22 ChromeJavaScriptNativeDialogViewsFactory() {} | 22 AthenaJavaScriptNativeDialogFactory() {} |
23 ~ChromeJavaScriptNativeDialogViewsFactory() override {} | 23 ~AthenaJavaScriptNativeDialogFactory() override {} |
24 | 24 |
25 private: | 25 private: |
| 26 // JavScriptNativeDialogFactory: |
26 NativeAppModalDialog* CreateNativeJavaScriptDialog( | 27 NativeAppModalDialog* CreateNativeJavaScriptDialog( |
27 JavaScriptAppModalDialog* dialog, | 28 JavaScriptAppModalDialog* dialog, |
28 gfx::NativeWindow parent_window) override{ | 29 gfx::NativeWindow parent_window) override{ |
29 JavaScriptAppModalDialogViews* d = nullptr; | 30 JavaScriptAppModalDialogViews* d = |
30 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 31 new JavaScriptAppModalDialogViews(dialog); |
31 d = new JavaScriptAppModalDialogViewsX11(dialog); | |
32 #else | |
33 d = new JavaScriptAppModalDialogViews(dialog); | |
34 #endif | |
35 CreateBrowserModalDialogViews(d, parent_window); | 32 CreateBrowserModalDialogViews(d, parent_window); |
36 return d; | 33 return d; |
37 } | 34 } |
38 | 35 |
39 DISALLOW_COPY_AND_ASSIGN(ChromeJavaScriptNativeDialogViewsFactory); | 36 DISALLOW_COPY_AND_ASSIGN(AthenaJavaScriptNativeDialogFactory); |
40 }; | 37 }; |
41 | 38 |
42 } // namespace | 39 } // namespace |
43 | 40 |
44 void InstallChromeJavaScriptNativeDialogFactory() { | 41 void InstallJavaScriptNativeDialogFactory() { |
45 SetJavaScriptNativeDialogFactory( | 42 SetJavaScriptNativeDialogFactory( |
46 make_scoped_ptr(new ChromeJavaScriptNativeDialogViewsFactory)); | 43 make_scoped_ptr(new AthenaJavaScriptNativeDialogFactory)); |
47 } | 44 } |
| 45 |
| 46 } // namespace athena |
OLD | NEW |