| 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/extension_process_bindings.h" | 5 #include "chrome/renderer/extensions/extension_process_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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 PendingRequest(v8::Persistent<v8::Context> context, const std::string& name, | 69 PendingRequest(v8::Persistent<v8::Context> context, const std::string& name, |
| 70 const std::string& extension_id) | 70 const std::string& extension_id) |
| 71 : context(context), name(name), extension_id(extension_id) { | 71 : context(context), name(name), extension_id(extension_id) { |
| 72 } | 72 } |
| 73 v8::Persistent<v8::Context> context; | 73 v8::Persistent<v8::Context> context; |
| 74 std::string name; | 74 std::string name; |
| 75 std::string extension_id; | 75 std::string extension_id; |
| 76 }; | 76 }; |
| 77 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap; | 77 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap; |
| 78 | 78 |
| 79 base::LazyInstance<PendingRequestMap> g_pending_requests( | 79 base::LazyInstance<PendingRequestMap> g_pending_requests = |
| 80 base::LINKER_INITIALIZED); | 80 LINKER_ZERO_INITIALIZED; |
| 81 | 81 |
| 82 // A RenderViewVisitor class that iterates through the set of available | 82 // A RenderViewVisitor class that iterates through the set of available |
| 83 // views, looking for a view of the given type, in the given browser window | 83 // views, looking for a view of the given type, in the given browser window |
| 84 // and within the given extension. | 84 // and within the given extension. |
| 85 // Used to accumulate the list of views associated with an extension. | 85 // Used to accumulate the list of views associated with an extension. |
| 86 class ExtensionViewAccumulator : public content::RenderViewVisitor { | 86 class ExtensionViewAccumulator : public content::RenderViewVisitor { |
| 87 public: | 87 public: |
| 88 ExtensionViewAccumulator(const std::string& extension_id, | 88 ExtensionViewAccumulator(const std::string& extension_id, |
| 89 int browser_window_id, | 89 int browser_window_id, |
| 90 content::ViewType view_type) | 90 content::ViewType view_type) |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 // static | 656 // static |
| 657 bool ExtensionProcessBindings::HasPendingRequests( | 657 bool ExtensionProcessBindings::HasPendingRequests( |
| 658 const std::string& extension_id) { | 658 const std::string& extension_id) { |
| 659 for (PendingRequestMap::const_iterator it = g_pending_requests.Get().begin(); | 659 for (PendingRequestMap::const_iterator it = g_pending_requests.Get().begin(); |
| 660 it != g_pending_requests.Get().end(); ++it) { | 660 it != g_pending_requests.Get().end(); ++it) { |
| 661 if (it->second->extension_id == extension_id) | 661 if (it->second->extension_id == extension_id) |
| 662 return true; | 662 return true; |
| 663 } | 663 } |
| 664 return false; | 664 return false; |
| 665 } | 665 } |
| OLD | NEW |