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