| 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/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2574 void RenderViewImpl::requestPointerUnlock() { | 2574 void RenderViewImpl::requestPointerUnlock() { |
| 2575 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); | 2575 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); |
| 2576 } | 2576 } |
| 2577 | 2577 |
| 2578 bool RenderViewImpl::isPointerLocked() { | 2578 bool RenderViewImpl::isPointerLocked() { |
| 2579 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2579 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2580 webwidget_mouse_lock_target_.get()); | 2580 webwidget_mouse_lock_target_.get()); |
| 2581 } | 2581 } |
| 2582 | 2582 |
| 2583 void RenderViewImpl::didActivateCompositor(int input_handler_identifier) { | 2583 void RenderViewImpl::didActivateCompositor(int input_handler_identifier) { |
| 2584 #if !defined(OS_MACOSX) // many events are unhandled - http://crbug.com/138003 | 2584 #if !defined(OS_MACOSX) // many events are unhandled - http://crbug.com/138003 |
| 2585 #if !defined(OS_WIN) // http://crbug.com/160122 | 2585 #if !defined(OS_WIN) // http://crbug.com/160122 |
| 2586 CompositorThread* compositor_thread = | 2586 CompositorThread* compositor_thread = |
| 2587 RenderThreadImpl::current()->compositor_thread(); | 2587 RenderThreadImpl::current()->compositor_thread(); |
| 2588 if (compositor_thread) | 2588 if (compositor_thread) |
| 2589 compositor_thread->AddInputHandler( | 2589 compositor_thread->AddInputHandler( |
| 2590 routing_id_, input_handler_identifier, AsWeakPtr()); | 2590 routing_id_, input_handler_identifier, AsWeakPtr()); |
| 2591 #endif | 2591 #endif |
| 2592 #endif | 2592 #endif |
| 2593 | 2593 |
| 2594 RenderWidget::didActivateCompositor(input_handler_identifier); | 2594 RenderWidget::didActivateCompositor(input_handler_identifier); |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4048 // in place. | 4048 // in place. |
| 4049 } | 4049 } |
| 4050 | 4050 |
| 4051 BrowserPluginManager* RenderViewImpl::browser_plugin_manager() { | 4051 BrowserPluginManager* RenderViewImpl::browser_plugin_manager() { |
| 4052 if (!browser_plugin_manager_) | 4052 if (!browser_plugin_manager_) |
| 4053 browser_plugin_manager_ = BrowserPluginManager::Create(this); | 4053 browser_plugin_manager_ = BrowserPluginManager::Create(this); |
| 4054 return browser_plugin_manager_; | 4054 return browser_plugin_manager_; |
| 4055 } | 4055 } |
| 4056 | 4056 |
| 4057 void RenderViewImpl::CreateFrameTree(WebKit::WebFrame* frame, | 4057 void RenderViewImpl::CreateFrameTree(WebKit::WebFrame* frame, |
| 4058 DictionaryValue* frame_tree) { | 4058 base::DictionaryValue* frame_tree) { |
| 4059 // TODO(nasko): Remove once http://crbug.com/153701 is fixed. | 4059 // TODO(nasko): Remove once http://crbug.com/153701 is fixed. |
| 4060 DCHECK(false); | 4060 DCHECK(false); |
| 4061 NavigateToSwappedOutURL(frame); | 4061 NavigateToSwappedOutURL(frame); |
| 4062 | 4062 |
| 4063 string16 name; | 4063 string16 name; |
| 4064 if (frame_tree->GetString(kFrameTreeNodeNameKey, &name) && !name.empty()) | 4064 if (frame_tree->GetString(kFrameTreeNodeNameKey, &name) && !name.empty()) |
| 4065 frame->setName(name); | 4065 frame->setName(name); |
| 4066 | 4066 |
| 4067 int remote_id; | 4067 int remote_id; |
| 4068 if (frame_tree->GetInteger(kFrameTreeNodeIdKey, &remote_id)) | 4068 if (frame_tree->GetInteger(kFrameTreeNodeIdKey, &remote_id)) |
| 4069 active_frame_id_map_.insert(std::pair<int, int>(frame->identifier(), | 4069 active_frame_id_map_.insert(std::pair<int, int>(frame->identifier(), |
| 4070 remote_id)); | 4070 remote_id)); |
| 4071 | 4071 |
| 4072 ListValue* children; | 4072 base::ListValue* children; |
| 4073 if (!frame_tree->GetList(kFrameTreeNodeSubtreeKey, &children)) | 4073 if (!frame_tree->GetList(kFrameTreeNodeSubtreeKey, &children)) |
| 4074 return; | 4074 return; |
| 4075 | 4075 |
| 4076 // Create an invisible iframe tree in the swapped out page. | 4076 // Create an invisible iframe tree in the swapped out page. |
| 4077 base::DictionaryValue* child; | 4077 base::DictionaryValue* child; |
| 4078 for (size_t i = 0; i < children->GetSize(); ++i) { | 4078 for (size_t i = 0; i < children->GetSize(); ++i) { |
| 4079 if (!children->GetDictionary(i, &child)) | 4079 if (!children->GetDictionary(i, &child)) |
| 4080 continue; | 4080 continue; |
| 4081 WebElement element = frame->document().createElement("iframe"); | 4081 WebElement element = frame->document().createElement("iframe"); |
| 4082 element.setAttribute("width", "0"); | 4082 element.setAttribute("width", "0"); |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4579 | 4579 |
| 4580 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, | 4580 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, |
| 4581 const string16& jscript, | 4581 const string16& jscript, |
| 4582 int id, | 4582 int id, |
| 4583 bool notify_result) { | 4583 bool notify_result) { |
| 4584 v8::Handle<v8::Value> result; | 4584 v8::Handle<v8::Value> result; |
| 4585 WebFrame* web_frame = GetChildFrame(frame_xpath); | 4585 WebFrame* web_frame = GetChildFrame(frame_xpath); |
| 4586 if (web_frame) | 4586 if (web_frame) |
| 4587 result = web_frame->executeScriptAndReturnValue(WebScriptSource(jscript)); | 4587 result = web_frame->executeScriptAndReturnValue(WebScriptSource(jscript)); |
| 4588 if (notify_result) { | 4588 if (notify_result) { |
| 4589 ListValue list; | 4589 base::ListValue list; |
| 4590 if (!result.IsEmpty() && web_frame) { | 4590 if (!result.IsEmpty() && web_frame) { |
| 4591 v8::HandleScope handle_scope; | 4591 v8::HandleScope handle_scope; |
| 4592 v8::Local<v8::Context> context = web_frame->mainWorldScriptContext(); | 4592 v8::Local<v8::Context> context = web_frame->mainWorldScriptContext(); |
| 4593 v8::Context::Scope context_scope(context); | 4593 v8::Context::Scope context_scope(context); |
| 4594 V8ValueConverterImpl converter; | 4594 V8ValueConverterImpl converter; |
| 4595 converter.SetDateAllowed(true); | 4595 converter.SetDateAllowed(true); |
| 4596 converter.SetRegExpAllowed(true); | 4596 converter.SetRegExpAllowed(true); |
| 4597 base::Value* result_value = converter.FromV8Value(result, context); | 4597 base::Value* result_value = converter.FromV8Value(result, context); |
| 4598 list.Set(0, result_value ? result_value : | 4598 list.Set(0, result_value ? result_value : base::Value::CreateNullValue()); |
| 4599 base::Value::CreateNullValue()); | |
| 4600 } else { | 4599 } else { |
| 4601 list.Set(0, Value::CreateNullValue()); | 4600 list.Set(0, base::Value::CreateNullValue()); |
| 4602 } | 4601 } |
| 4603 Send(new ViewHostMsg_ScriptEvalResponse(routing_id_, id, list)); | 4602 Send(new ViewHostMsg_ScriptEvalResponse(routing_id_, id, list)); |
| 4604 } | 4603 } |
| 4605 } | 4604 } |
| 4606 | 4605 |
| 4607 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { | 4606 bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { |
| 4608 return (!send_preferred_size_changes_ || | 4607 return (!send_preferred_size_changes_ || |
| 4609 (disable_scrollbars_size_limit_.width() <= width || | 4608 (disable_scrollbars_size_limit_.width() <= width || |
| 4610 disable_scrollbars_size_limit_.height() <= height)); | 4609 disable_scrollbars_size_limit_.height() <= height)); |
| 4611 } | 4610 } |
| (...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6661 } | 6660 } |
| 6662 #endif | 6661 #endif |
| 6663 | 6662 |
| 6664 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6663 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
| 6665 TransportDIB::Handle dib_handle) { | 6664 TransportDIB::Handle dib_handle) { |
| 6666 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6665 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
| 6667 RenderProcess::current()->ReleaseTransportDIB(dib); | 6666 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 6668 } | 6667 } |
| 6669 | 6668 |
| 6670 } // namespace content | 6669 } // namespace content |
| OLD | NEW |