OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/streams_private/streams_private_api.h" | 5 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 GURL url = stream->GetURL(); | 70 GURL url = stream->GetURL(); |
71 streams_[extension_id][url] = make_linked_ptr(stream.release()); | 71 streams_[extension_id][url] = make_linked_ptr(stream.release()); |
72 } | 72 } |
73 | 73 |
74 static base::LazyInstance<ProfileKeyedAPIFactory<StreamsPrivateAPI> > | 74 static base::LazyInstance<ProfileKeyedAPIFactory<StreamsPrivateAPI> > |
75 g_factory = LAZY_INSTANCE_INITIALIZER; | 75 g_factory = LAZY_INSTANCE_INITIALIZER; |
76 | 76 |
77 // static | 77 // static |
78 ProfileKeyedAPIFactory<StreamsPrivateAPI>* | 78 ProfileKeyedAPIFactory<StreamsPrivateAPI>* |
79 StreamsPrivateAPI::GetFactoryInstance() { | 79 StreamsPrivateAPI::GetFactoryInstance() { |
80 return &g_factory.Get(); | 80 return g_factory.Pointer(); |
81 } | 81 } |
82 | 82 |
83 void StreamsPrivateAPI::Observe(int type, | 83 void StreamsPrivateAPI::Observe(int type, |
84 const content::NotificationSource& source, | 84 const content::NotificationSource& source, |
85 const content::NotificationDetails& details) { | 85 const content::NotificationDetails& details) { |
86 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 86 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
87 const Extension* extension = | 87 const Extension* extension = |
88 content::Details<const UnloadedExtensionInfo>(details)->extension; | 88 content::Details<const UnloadedExtensionInfo>(details)->extension; |
89 streams_.erase(extension->id()); | 89 streams_.erase(extension->id()); |
90 } | 90 } |
91 } | 91 } |
92 } // namespace extensions | 92 } // namespace extensions |
OLD | NEW |