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 "athena/extensions/public/extensions_delegate.h" | 5 #include "athena/extensions/public/extensions_delegate.h" |
6 | 6 |
7 #include "athena/extensions/athena_constrained_window_views_client.h" | 7 #include "athena/extensions/athena_constrained_window_views_client.h" |
8 #include "athena/extensions/athena_javascript_native_dialog_factory.h" | 8 #include "athena/extensions/athena_javascript_native_dialog_factory.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "extensions/components/javascript_dialog_extensions_client/javascript_d
ialog_extension_client_impl.h" | 10 #include "extensions/components/javascript_dialog_extensions_client/javascript_d
ialog_extension_client_impl.h" |
11 | 11 |
12 namespace athena { | 12 namespace athena { |
13 namespace { | 13 namespace { |
14 | 14 |
15 ExtensionsDelegate* instance = nullptr; | 15 ExtensionsDelegate* instance = nullptr; |
16 | 16 |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 ExtensionsDelegate::ExtensionsDelegate() { | 19 ExtensionsDelegate::ExtensionsDelegate() { |
20 InstallConstrainedWindowViewsClient(); | 20 InstallConstrainedWindowViewsClient(); |
21 InstallJavaScriptDialogExtensionsClient(); | 21 javascript_dialog_extensions_client::InstallClient(); |
22 InstallJavaScriptNativeDialogFactory(); | 22 InstallJavaScriptNativeDialogFactory(); |
23 DCHECK(!instance); | 23 DCHECK(!instance); |
24 instance = this; | 24 instance = this; |
25 } | 25 } |
26 | 26 |
27 ExtensionsDelegate::~ExtensionsDelegate() { | 27 ExtensionsDelegate::~ExtensionsDelegate() { |
28 UninstallConstrainedWindowViewsClient(); | 28 UninstallConstrainedWindowViewsClient(); |
29 DCHECK(instance); | 29 DCHECK(instance); |
30 instance = nullptr; | 30 instance = nullptr; |
31 } | 31 } |
32 | 32 |
33 // static | 33 // static |
34 ExtensionsDelegate* ExtensionsDelegate::Get(content::BrowserContext* context) { | 34 ExtensionsDelegate* ExtensionsDelegate::Get(content::BrowserContext* context) { |
35 DCHECK(instance); | 35 DCHECK(instance); |
36 DCHECK_EQ(context, instance->GetBrowserContext()); | 36 DCHECK_EQ(context, instance->GetBrowserContext()); |
37 return instance; | 37 return instance; |
38 } | 38 } |
39 | 39 |
40 // static | 40 // static |
41 void ExtensionsDelegate::Shutdown() { | 41 void ExtensionsDelegate::Shutdown() { |
42 DCHECK(instance); | 42 DCHECK(instance); |
43 delete instance; | 43 delete instance; |
44 } | 44 } |
45 | 45 |
46 } // namespace athena | 46 } // namespace athena |
OLD | NEW |