| 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 "content/renderer/render_view.h" | 5 #include "content/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 if (main_frame) | 574 if (main_frame) |
| 575 content::GetContentClient()->SetActiveURL(main_frame->document().url()); | 575 content::GetContentClient()->SetActiveURL(main_frame->document().url()); |
| 576 | 576 |
| 577 ObserverListBase<RenderViewObserver>::Iterator it(observers_); | 577 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
| 578 RenderViewObserver* observer; | 578 RenderViewObserver* observer; |
| 579 while ((observer = it.GetNext()) != NULL) | 579 while ((observer = it.GetNext()) != NULL) |
| 580 if (observer->OnMessageReceived(message)) | 580 if (observer->OnMessageReceived(message)) |
| 581 return true; | 581 return true; |
| 582 | 582 |
| 583 bool handled = true; | 583 bool handled = true; |
| 584 IPC_BEGIN_MESSAGE_MAP(RenderView, message) | 584 bool msg_is_ok = true; |
| 585 IPC_BEGIN_MESSAGE_MAP_EX(RenderView, message, msg_is_ok) |
| 585 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) | 586 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) |
| 586 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) | 587 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) |
| 587 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) | 588 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) |
| 588 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) | 589 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) |
| 589 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) | 590 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) |
| 590 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) | 591 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) |
| 591 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) | 592 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) |
| 592 #if defined(OS_MACOSX) | 593 #if defined(OS_MACOSX) |
| 593 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) | 594 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) |
| 594 #endif | 595 #endif |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 682 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
| 682 OnSetHistoryLengthAndPrune) | 683 OnSetHistoryLengthAndPrune) |
| 683 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 684 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 684 IPC_MESSAGE_HANDLER(IntentsMsg_WebIntentReply, OnWebIntentReply); | 685 IPC_MESSAGE_HANDLER(IntentsMsg_WebIntentReply, OnWebIntentReply); |
| 685 IPC_MESSAGE_HANDLER(ViewMsg_LockMouse_ACK, OnLockMouseACK) | 686 IPC_MESSAGE_HANDLER(ViewMsg_LockMouse_ACK, OnLockMouseACK) |
| 686 IPC_MESSAGE_HANDLER(ViewMsg_MouseLockLost, OnMouseLockLost) | 687 IPC_MESSAGE_HANDLER(ViewMsg_MouseLockLost, OnMouseLockLost) |
| 687 | 688 |
| 688 // Have the super handle all other messages. | 689 // Have the super handle all other messages. |
| 689 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 690 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
| 690 IPC_END_MESSAGE_MAP() | 691 IPC_END_MESSAGE_MAP() |
| 692 |
| 693 if (!msg_is_ok) { |
| 694 // The message had a handler, but its deserialization failed. |
| 695 // Kill the renderer to avoid potential spoofing attacks. |
| 696 CHECK(false) << "Unable to deserialize message in RenderView."; |
| 697 } |
| 698 |
| 691 return handled; | 699 return handled; |
| 692 } | 700 } |
| 693 | 701 |
| 694 void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { | 702 void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { |
| 695 if (!webview()) | 703 if (!webview()) |
| 696 return; | 704 return; |
| 697 | 705 |
| 698 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); | 706 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); |
| 699 | 707 |
| 700 bool is_reload = | 708 bool is_reload = |
| (...skipping 3701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4402 } | 4410 } |
| 4403 | 4411 |
| 4404 void RenderView::OnLockMouseACK(bool succeeded) { | 4412 void RenderView::OnLockMouseACK(bool succeeded) { |
| 4405 pepper_delegate_.OnLockMouseACK(succeeded); | 4413 pepper_delegate_.OnLockMouseACK(succeeded); |
| 4406 } | 4414 } |
| 4407 | 4415 |
| 4408 void RenderView::OnMouseLockLost() { | 4416 void RenderView::OnMouseLockLost() { |
| 4409 pepper_delegate_.OnMouseLockLost(); | 4417 pepper_delegate_.OnMouseLockLost(); |
| 4410 } | 4418 } |
| 4411 | 4419 |
| OLD | NEW |