| 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> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "chrome/common/extensions/extension.h" | 20 #include "chrome/common/extensions/extension.h" |
| 21 #include "chrome/common/extensions/extension_action.h" | 21 #include "chrome/common/extensions/extension_action.h" |
| 22 #include "chrome/common/extensions/extension_constants.h" | 22 #include "chrome/common/extensions/extension_constants.h" |
| 23 #include "chrome/common/extensions/extension_messages.h" | 23 #include "chrome/common/extensions/extension_messages.h" |
| 24 #include "chrome/common/extensions/extension_set.h" | 24 #include "chrome/common/extensions/extension_set.h" |
| 25 #include "chrome/common/extensions/url_pattern.h" | 25 #include "chrome/common/extensions/url_pattern.h" |
| 26 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
| 27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
| 28 #include "content/public/renderer/render_view_visitor.h" |
| 28 #include "chrome/renderer/chrome_render_process_observer.h" | 29 #include "chrome/renderer/chrome_render_process_observer.h" |
| 29 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 30 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
| 30 #include "chrome/renderer/extensions/event_bindings.h" | 31 #include "chrome/renderer/extensions/event_bindings.h" |
| 31 #include "chrome/renderer/extensions/extension_bindings_context.h" | 32 #include "chrome/renderer/extensions/extension_bindings_context.h" |
| 32 #include "chrome/renderer/extensions/extension_dispatcher.h" | 33 #include "chrome/renderer/extensions/extension_dispatcher.h" |
| 33 #include "chrome/renderer/extensions/extension_helper.h" | 34 #include "chrome/renderer/extensions/extension_helper.h" |
| 34 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 35 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
| 35 #include "chrome/renderer/extensions/user_script_slave.h" | 36 #include "chrome/renderer/extensions/user_script_slave.h" |
| 36 #include "chrome/renderer/static_v8_external_string_resource.h" | 37 #include "chrome/renderer/static_v8_external_string_resource.h" |
| 37 #include "content/renderer/render_view.h" | 38 #include "content/renderer/render_view.h" |
| 38 #include "content/renderer/render_view_visitor.h" | |
| 39 #include "grit/common_resources.h" | 39 #include "grit/common_resources.h" |
| 40 #include "grit/renderer_resources.h" | 40 #include "grit/renderer_resources.h" |
| 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h" |
| 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 45 #include "third_party/skia/include/core/SkBitmap.h" | 45 #include "third_party/skia/include/core/SkBitmap.h" |
| 46 #include "third_party/skia/include/core/SkColor.h" | 46 #include "third_party/skia/include/core/SkColor.h" |
| 47 #include "ui/base/resource/resource_bundle.h" | 47 #include "ui/base/resource/resource_bundle.h" |
| 48 #include "v8/include/v8.h" | 48 #include "v8/include/v8.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 71 }; | 71 }; |
| 72 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap; | 72 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap; |
| 73 | 73 |
| 74 base::LazyInstance<PendingRequestMap> g_pending_requests( | 74 base::LazyInstance<PendingRequestMap> g_pending_requests( |
| 75 base::LINKER_INITIALIZED); | 75 base::LINKER_INITIALIZED); |
| 76 | 76 |
| 77 // A RenderViewVisitor class that iterates through the set of available | 77 // A RenderViewVisitor class that iterates through the set of available |
| 78 // views, looking for a view of the given type, in the given browser window | 78 // views, looking for a view of the given type, in the given browser window |
| 79 // and within the given extension. | 79 // and within the given extension. |
| 80 // Used to accumulate the list of views associated with an extension. | 80 // Used to accumulate the list of views associated with an extension. |
| 81 class ExtensionViewAccumulator : public RenderViewVisitor { | 81 class ExtensionViewAccumulator : public content::RenderViewVisitor { |
| 82 public: | 82 public: |
| 83 ExtensionViewAccumulator(const std::string& extension_id, | 83 ExtensionViewAccumulator(const std::string& extension_id, |
| 84 int browser_window_id, | 84 int browser_window_id, |
| 85 ViewType::Type view_type) | 85 ViewType::Type view_type) |
| 86 : extension_id_(extension_id), | 86 : extension_id_(extension_id), |
| 87 browser_window_id_(browser_window_id), | 87 browser_window_id_(browser_window_id), |
| 88 view_type_(view_type), | 88 view_type_(view_type), |
| 89 views_(v8::Array::New()), | 89 views_(v8::Array::New()), |
| 90 index_(0) { | 90 index_(0) { |
| 91 } | 91 } |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 if (!retval.IsEmpty() && !retval->IsUndefined()) { | 624 if (!retval.IsEmpty() && !retval->IsUndefined()) { |
| 625 std::string error = *v8::String::AsciiValue(retval); | 625 std::string error = *v8::String::AsciiValue(retval); |
| 626 DCHECK(false) << error; | 626 DCHECK(false) << error; |
| 627 } | 627 } |
| 628 #endif | 628 #endif |
| 629 | 629 |
| 630 request->second->context.Dispose(); | 630 request->second->context.Dispose(); |
| 631 request->second->context.Clear(); | 631 request->second->context.Clear(); |
| 632 g_pending_requests.Get().erase(request); | 632 g_pending_requests.Get().erase(request); |
| 633 } | 633 } |
| OLD | NEW |