Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: athena/extensions/shell/extensions_delegate_impl.cc

Issue 498023003: Delete activity upon window deletion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reformat Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "extensions/common/extension_set.h" 7 #include "extensions/common/extension_set.h"
8 #include "extensions/shell/browser/shell_extension_system.h" 8 #include "extensions/shell/browser/shell_extension_system.h"
9 9
10 namespace athena { 10 namespace athena {
11 namespace { 11 namespace {
12 12
13 ExtensionsDelegate* instance = NULL;
14
15 class ShellExtensionsDelegate : public ExtensionsDelegate { 13 class ShellExtensionsDelegate : public ExtensionsDelegate {
16 public: 14 public:
17 explicit ShellExtensionsDelegate(content::BrowserContext* context) 15 explicit ShellExtensionsDelegate(content::BrowserContext* context)
18 : context_(context), 16 : context_(context),
19 extension_system_(static_cast<extensions::ShellExtensionSystem*>( 17 extension_system_(static_cast<extensions::ShellExtensionSystem*>(
20 extensions::ExtensionSystem::Get(context))) {} 18 extensions::ExtensionSystem::Get(context))) {}
21 19
22 virtual ~ShellExtensionsDelegate() {} 20 virtual ~ShellExtensionsDelegate() {}
23 21
24 private: 22 private:
(...skipping 13 matching lines...) Expand all
38 36
39 content::BrowserContext* context_; 37 content::BrowserContext* context_;
40 extensions::ShellExtensionSystem* extension_system_; 38 extensions::ShellExtensionSystem* extension_system_;
41 extensions::ExtensionSet shell_extensions_; 39 extensions::ExtensionSet shell_extensions_;
42 40
43 DISALLOW_COPY_AND_ASSIGN(ShellExtensionsDelegate); 41 DISALLOW_COPY_AND_ASSIGN(ShellExtensionsDelegate);
44 }; 42 };
45 43
46 } // namespace 44 } // namespace
47 45
48 ExtensionsDelegate::ExtensionsDelegate() {
49 DCHECK(!instance);
50 instance = this;
51 }
52
53 ExtensionsDelegate::~ExtensionsDelegate() {
54 DCHECK(instance);
55 instance = NULL;
56 }
57
58 // static
59 ExtensionsDelegate* ExtensionsDelegate::Get(content::BrowserContext* context) {
60 DCHECK(instance);
61 DCHECK_EQ(context, instance->GetBrowserContext());
62 return instance;
63 }
64
65 // static 46 // static
66 void ExtensionsDelegate::CreateExtensionsDelegateForShell( 47 void ExtensionsDelegate::CreateExtensionsDelegateForShell(
67 content::BrowserContext* context) { 48 content::BrowserContext* context) {
68 new ShellExtensionsDelegate(context); 49 new ShellExtensionsDelegate(context);
69 } 50 }
70 51
71 // static
72 void ExtensionsDelegate::Shutdown() {
73 DCHECK(instance);
74 delete instance;
75 }
76
77 } // namespace athena 52 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698