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 "content/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bit_cast.h" | 10 #include "base/bit_cast.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 // the instance is invalid, returns false and |*security_origin| will be | 292 // the instance is invalid, returns false and |*security_origin| will be |
293 // unchanged. | 293 // unchanged. |
294 bool SecurityOriginForInstance(PP_Instance instance_id, | 294 bool SecurityOriginForInstance(PP_Instance instance_id, |
295 blink::WebSecurityOrigin* security_origin) { | 295 blink::WebSecurityOrigin* security_origin) { |
296 PepperPluginInstanceImpl* instance = | 296 PepperPluginInstanceImpl* instance = |
297 HostGlobals::Get()->GetInstance(instance_id); | 297 HostGlobals::Get()->GetInstance(instance_id); |
298 if (!instance) | 298 if (!instance) |
299 return false; | 299 return false; |
300 | 300 |
301 WebElement plugin_element = instance->container()->element(); | 301 WebElement plugin_element = instance->container()->element(); |
302 *security_origin = plugin_element.document().securityOrigin(); | 302 *security_origin = plugin_element.document().getSecurityOrigin(); |
303 return true; | 303 return true; |
304 } | 304 } |
305 | 305 |
306 // Convert the given vector to an array of C-strings. The strings in the | 306 // Convert the given vector to an array of C-strings. The strings in the |
307 // returned vector are only guaranteed valid so long as the vector of strings | 307 // returned vector are only guaranteed valid so long as the vector of strings |
308 // is not modified. | 308 // is not modified. |
309 scoped_ptr<const char* []> StringVectorToArgArray( | 309 scoped_ptr<const char* []> StringVectorToArgArray( |
310 const std::vector<std::string>& vector) { | 310 const std::vector<std::string>& vector) { |
311 scoped_ptr<const char * []> array(new const char* [vector.size()]); | 311 scoped_ptr<const char * []> array(new const char* [vector.size()]); |
312 for (size_t i = 0; i < vector.size(); ++i) | 312 for (size_t i = 0; i < vector.size(); ++i) |
(...skipping 2860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3173 return false; | 3173 return false; |
3174 blink::WebDocument containing_document = container_->element().document(); | 3174 blink::WebDocument containing_document = container_->element().document(); |
3175 | 3175 |
3176 if (!containing_document.frame() || !containing_document.frame()->view() || | 3176 if (!containing_document.frame() || !containing_document.frame()->view() || |
3177 !containing_document.frame()->view()->mainFrame()) { | 3177 !containing_document.frame()->view()->mainFrame()) { |
3178 return false; | 3178 return false; |
3179 } | 3179 } |
3180 blink::WebDocument main_document = | 3180 blink::WebDocument main_document = |
3181 containing_document.frame()->view()->mainFrame()->document(); | 3181 containing_document.frame()->view()->mainFrame()->document(); |
3182 | 3182 |
3183 return containing_document.securityOrigin().canAccess( | 3183 return containing_document.getSecurityOrigin().canAccess( |
3184 main_document.securityOrigin()); | 3184 main_document.getSecurityOrigin()); |
3185 } | 3185 } |
3186 | 3186 |
3187 void PepperPluginInstanceImpl::KeepSizeAttributesBeforeFullscreen() { | 3187 void PepperPluginInstanceImpl::KeepSizeAttributesBeforeFullscreen() { |
3188 WebElement element = container_->element(); | 3188 WebElement element = container_->element(); |
3189 width_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kWidth)); | 3189 width_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kWidth)); |
3190 height_before_fullscreen_ = | 3190 height_before_fullscreen_ = |
3191 element.getAttribute(WebString::fromUTF8(kHeight)); | 3191 element.getAttribute(WebString::fromUTF8(kHeight)); |
3192 border_before_fullscreen_ = | 3192 border_before_fullscreen_ = |
3193 element.getAttribute(WebString::fromUTF8(kBorder)); | 3193 element.getAttribute(WebString::fromUTF8(kBorder)); |
3194 style_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kStyle)); | 3194 style_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kStyle)); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3322 } | 3322 } |
3323 | 3323 |
3324 void PepperPluginInstanceImpl::ConvertDIPToViewport(gfx::Rect* rect) const { | 3324 void PepperPluginInstanceImpl::ConvertDIPToViewport(gfx::Rect* rect) const { |
3325 rect->set_x(rect->x() / viewport_to_dip_scale_); | 3325 rect->set_x(rect->x() / viewport_to_dip_scale_); |
3326 rect->set_y(rect->y() / viewport_to_dip_scale_); | 3326 rect->set_y(rect->y() / viewport_to_dip_scale_); |
3327 rect->set_width(rect->width() / viewport_to_dip_scale_); | 3327 rect->set_width(rect->width() / viewport_to_dip_scale_); |
3328 rect->set_height(rect->height() / viewport_to_dip_scale_); | 3328 rect->set_height(rect->height() / viewport_to_dip_scale_); |
3329 } | 3329 } |
3330 | 3330 |
3331 } // namespace content | 3331 } // namespace content |
OLD | NEW |