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 "athena/extensions/athena_javascript_native_dialog_factory.h" | |
6 | |
7 #include "base/memory/scoped_ptr.h" | |
8 #include "components/app_modal/javascript_dialog_manager.h" | |
9 #include "components/app_modal/javascript_native_dialog_factory.h" | |
10 #include "components/app_modal/views/javascript_app_modal_dialog_views.h" | |
11 #include "components/constrained_window/constrained_window_views.h" | |
12 | |
13 class JavaScriptAppModalDialog; | |
14 class NativeAppModalDialog; | |
15 | |
16 namespace athena { | |
17 namespace { | |
18 | |
19 class AthenaJavaScriptNativeDialogFactory | |
20 : public app_modal::JavaScriptNativeDialogFactory { | |
21 public: | |
22 AthenaJavaScriptNativeDialogFactory() {} | |
23 ~AthenaJavaScriptNativeDialogFactory() override {} | |
24 | |
25 private: | |
26 // app_modal::JavScriptNativeDialogFactory: | |
27 app_modal::NativeAppModalDialog* CreateNativeJavaScriptDialog( | |
28 app_modal::JavaScriptAppModalDialog* dialog, | |
29 gfx::NativeWindow parent_window) override{ | |
30 app_modal::JavaScriptAppModalDialogViews* d = | |
31 new app_modal::JavaScriptAppModalDialogViews(dialog); | |
32 constrained_window::CreateBrowserModalDialogViews(d, parent_window); | |
33 return d; | |
34 } | |
35 | |
36 DISALLOW_COPY_AND_ASSIGN(AthenaJavaScriptNativeDialogFactory); | |
37 }; | |
38 | |
39 } // namespace | |
40 | |
41 void InstallJavaScriptNativeDialogFactory() { | |
42 app_modal::JavaScriptDialogManager::GetInstance()-> | |
43 SetNativeDialogFactory( | |
44 make_scoped_ptr(new AthenaJavaScriptNativeDialogFactory)); | |
45 } | |
46 | |
47 } // namespace athena | |
OLD | NEW |