OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/extensions/schema_generated_bindings.h" | 5 #include "chrome/renderer/extensions/schema_generated_bindings.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 PendingRequest(v8::Persistent<v8::Context> context, const std::string& name, | 72 PendingRequest(v8::Persistent<v8::Context> context, const std::string& name, |
73 const std::string& extension_id) | 73 const std::string& extension_id) |
74 : context(context), name(name), extension_id(extension_id) { | 74 : context(context), name(name), extension_id(extension_id) { |
75 } | 75 } |
76 v8::Persistent<v8::Context> context; | 76 v8::Persistent<v8::Context> context; |
77 std::string name; | 77 std::string name; |
78 std::string extension_id; | 78 std::string extension_id; |
79 }; | 79 }; |
80 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap; | 80 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap; |
81 | 81 |
82 base::LazyInstance<PendingRequestMap> g_pending_requests( | 82 base::LazyInstance<PendingRequestMap> g_pending_requests = |
83 base::LINKER_INITIALIZED); | 83 LAZY_INSTANCE_INITIALIZER; |
84 | 84 |
85 // A RenderViewVisitor class that iterates through the set of available | 85 // A RenderViewVisitor class that iterates through the set of available |
86 // views, looking for a view of the given type, in the given browser window | 86 // views, looking for a view of the given type, in the given browser window |
87 // and within the given extension. | 87 // and within the given extension. |
88 // Used to accumulate the list of views associated with an extension. | 88 // Used to accumulate the list of views associated with an extension. |
89 class ExtensionViewAccumulator : public content::RenderViewVisitor { | 89 class ExtensionViewAccumulator : public content::RenderViewVisitor { |
90 public: | 90 public: |
91 ExtensionViewAccumulator(const std::string& extension_id, | 91 ExtensionViewAccumulator(const std::string& extension_id, |
92 int browser_window_id, | 92 int browser_window_id, |
93 content::ViewType view_type) | 93 content::ViewType view_type) |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 const std::string& extension_id) { | 688 const std::string& extension_id) { |
689 for (PendingRequestMap::const_iterator it = g_pending_requests.Get().begin(); | 689 for (PendingRequestMap::const_iterator it = g_pending_requests.Get().begin(); |
690 it != g_pending_requests.Get().end(); ++it) { | 690 it != g_pending_requests.Get().end(); ++it) { |
691 if (it->second->extension_id == extension_id) | 691 if (it->second->extension_id == extension_id) |
692 return true; | 692 return true; |
693 } | 693 } |
694 return false; | 694 return false; |
695 } | 695 } |
696 | 696 |
697 } // namespace | 697 } // namespace |
OLD | NEW |