| 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/browser/renderer_host/render_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 gfx::Point(client_x, client_y), | 573 gfx::Point(client_x, client_y), |
| 574 gfx::Point(screen_x, screen_y), | 574 gfx::Point(screen_x, screen_y), |
| 575 false, WebDragOperationNone)); | 575 false, WebDragOperationNone)); |
| 576 } | 576 } |
| 577 | 577 |
| 578 void RenderViewHost::DragSourceSystemDragEnded() { | 578 void RenderViewHost::DragSourceSystemDragEnded() { |
| 579 Send(new DragMsg_SourceSystemDragEnded(routing_id())); | 579 Send(new DragMsg_SourceSystemDragEnded(routing_id())); |
| 580 } | 580 } |
| 581 | 581 |
| 582 void RenderViewHost::AllowBindings(int bindings_flags) { | 582 void RenderViewHost::AllowBindings(int bindings_flags) { |
| 583 // Ensure we aren't granting bindings to a process that has already |
| 584 // been used for non-privileged views. |
| 585 if (process()->HasConnection() && |
| 586 !ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings( |
| 587 process()->GetID())) { |
| 588 // This process has no bindings yet. Make sure it does not have more |
| 589 // than this single view. |
| 590 content::RenderProcessHost::listeners_iterator iter( |
| 591 process()->ListenersIterator()); |
| 592 iter.Advance(); |
| 593 if (!iter.IsAtEnd()) |
| 594 return; |
| 595 } |
| 596 |
| 583 if (bindings_flags & content::BINDINGS_POLICY_WEB_UI) { | 597 if (bindings_flags & content::BINDINGS_POLICY_WEB_UI) { |
| 584 ChildProcessSecurityPolicy::GetInstance()->GrantWebUIBindings( | 598 ChildProcessSecurityPolicy::GetInstance()->GrantWebUIBindings( |
| 585 process()->GetID()); | 599 process()->GetID()); |
| 586 } | 600 } |
| 587 | 601 |
| 588 enabled_bindings_ |= bindings_flags; | 602 enabled_bindings_ |= bindings_flags; |
| 589 if (renderer_initialized_) | 603 if (renderer_initialized_) |
| 590 Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); | 604 Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); |
| 591 } | 605 } |
| 592 | 606 |
| 593 void RenderViewHost::SetWebUIProperty(const std::string& name, | 607 void RenderViewHost::SetWebUIProperty(const std::string& name, |
| 594 const std::string& value) { | 608 const std::string& value) { |
| 595 DCHECK(enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI); | 609 // This is just a sanity check before telling the renderer to enable the |
| 596 Send(new ViewMsg_SetWebUIProperty(routing_id(), name, value)); | 610 // property. It could lie and send the corresponding IPC messages anyway, |
| 611 // but we will not act on them if enabled_bindings_ doesn't agree. |
| 612 if (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) |
| 613 Send(new ViewMsg_SetWebUIProperty(routing_id(), name, value)); |
| 614 else |
| 615 NOTREACHED() << "WebUI bindings not enabled."; |
| 597 } | 616 } |
| 598 | 617 |
| 599 void RenderViewHost::GotFocus() { | 618 void RenderViewHost::GotFocus() { |
| 600 RenderWidgetHost::GotFocus(); // Notifies the renderer it got focus. | 619 RenderWidgetHost::GotFocus(); // Notifies the renderer it got focus. |
| 601 | 620 |
| 602 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 621 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 603 if (view) | 622 if (view) |
| 604 view->GotFocus(); | 623 view->GotFocus(); |
| 605 } | 624 } |
| 606 | 625 |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 // Whenever we change swap out state, we should not be waiting for | 1572 // Whenever we change swap out state, we should not be waiting for |
| 1554 // beforeunload or unload acks. We clear them here to be safe, since they | 1573 // beforeunload or unload acks. We clear them here to be safe, since they |
| 1555 // can cause navigations to be ignored in OnMsgNavigate. | 1574 // can cause navigations to be ignored in OnMsgNavigate. |
| 1556 is_waiting_for_beforeunload_ack_ = false; | 1575 is_waiting_for_beforeunload_ack_ = false; |
| 1557 is_waiting_for_unload_ack_ = false; | 1576 is_waiting_for_unload_ack_ = false; |
| 1558 } | 1577 } |
| 1559 | 1578 |
| 1560 void RenderViewHost::ClearPowerSaveBlockers() { | 1579 void RenderViewHost::ClearPowerSaveBlockers() { |
| 1561 STLDeleteValues(&power_save_blockers_); | 1580 STLDeleteValues(&power_save_blockers_); |
| 1562 } | 1581 } |
| OLD | NEW |