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/renderer/extensions/extension_custom_bindings.h" | 5 #include "chrome/renderer/extensions/extension_custom_bindings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/common/chrome_view_type.h" | 10 #include "chrome/common/chrome_view_type.h" |
| 11 #include "chrome/common/extensions/extension.h" |
11 #include "chrome/common/extensions/extension_action.h" | 12 #include "chrome/common/extensions/extension_action.h" |
12 #include "chrome/common/extensions/extension_messages.h" | 13 #include "chrome/common/extensions/extension_messages.h" |
13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
14 #include "chrome/renderer/extensions/extension_dispatcher.h" | 15 #include "chrome/renderer/extensions/extension_dispatcher.h" |
15 #include "chrome/renderer/extensions/extension_helper.h" | 16 #include "chrome/renderer/extensions/extension_helper.h" |
16 #include "content/public/renderer/render_view.h" | 17 #include "content/public/renderer/render_view.h" |
17 #include "grit/renderer_resources.h" | 18 #include "grit/renderer_resources.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
20 #include "webkit/glue/webkit_glue.h" | 21 #include "webkit/glue/webkit_glue.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } else if (view_type_string == chrome::kViewTypeAppShell) { | 67 } else if (view_type_string == chrome::kViewTypeAppShell) { |
67 view_type = chrome::VIEW_TYPE_APP_SHELL; | 68 view_type = chrome::VIEW_TYPE_APP_SHELL; |
68 } else if (view_type_string == chrome::kViewTypePanel) { | 69 } else if (view_type_string == chrome::kViewTypePanel) { |
69 view_type = chrome::VIEW_TYPE_PANEL; | 70 view_type = chrome::VIEW_TYPE_PANEL; |
70 } else if (view_type_string != chrome::kViewTypeAll) { | 71 } else if (view_type_string != chrome::kViewTypeAll) { |
71 return v8::Undefined(); | 72 return v8::Undefined(); |
72 } | 73 } |
73 | 74 |
74 ExtensionCustomBindings* v8_extension = | 75 ExtensionCustomBindings* v8_extension = |
75 GetFromArguments<ExtensionCustomBindings>(args); | 76 GetFromArguments<ExtensionCustomBindings>(args); |
76 const ::Extension* extension = | 77 const Extension* extension = |
77 v8_extension->GetExtensionForCurrentRenderView(); | 78 v8_extension->GetExtensionForCurrentRenderView(); |
78 if (!extension) | 79 if (!extension) |
79 return v8::Undefined(); | 80 return v8::Undefined(); |
80 | 81 |
81 std::vector<content::RenderView*> views = ExtensionHelper::GetExtensionViews( | 82 std::vector<content::RenderView*> views = ExtensionHelper::GetExtensionViews( |
82 extension->id(), browser_window_id, view_type); | 83 extension->id(), browser_window_id, view_type); |
83 v8::Local<v8::Array> v8_views = v8::Array::New(); | 84 v8::Local<v8::Array> v8_views = v8::Array::New(); |
84 int v8_index = 0; | 85 int v8_index = 0; |
85 for (size_t i = 0; i < views.size(); ++i) { | 86 for (size_t i = 0; i < views.size(); ++i) { |
86 v8::Local<v8::Context> context = | 87 v8::Local<v8::Context> context = |
(...skipping 30 matching lines...) Expand all Loading... |
117 renderview->Send(new ExtensionHostMsg_OpenChannelToExtension( | 118 renderview->Send(new ExtensionHostMsg_OpenChannelToExtension( |
118 renderview->GetRoutingID(), | 119 renderview->GetRoutingID(), |
119 source_id, | 120 source_id, |
120 target_id, | 121 target_id, |
121 channel_name, | 122 channel_name, |
122 &port_id)); | 123 &port_id)); |
123 return v8::Integer::New(port_id); | 124 return v8::Integer::New(port_id); |
124 } | 125 } |
125 | 126 |
126 } // namespace extensions | 127 } // namespace extensions |
OLD | NEW |