| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser/renderer_host/render_view_host.h" | 5 #include "chrome/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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 net::LoadState load_state, | 669 net::LoadState load_state, |
| 670 uint64 upload_position, | 670 uint64 upload_position, |
| 671 uint64 upload_size) { | 671 uint64 upload_size) { |
| 672 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size); | 672 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size); |
| 673 } | 673 } |
| 674 | 674 |
| 675 bool RenderViewHost::SuddenTerminationAllowed() const { | 675 bool RenderViewHost::SuddenTerminationAllowed() const { |
| 676 return sudden_termination_allowed_ || process()->sudden_termination_allowed(); | 676 return sudden_termination_allowed_ || process()->sudden_termination_allowed(); |
| 677 } | 677 } |
| 678 | 678 |
| 679 void RenderViewHost::RequestAccessibilityTree() { | |
| 680 Send(new ViewMsg_GetAccessibilityTree(routing_id())); | |
| 681 } | |
| 682 | |
| 683 /////////////////////////////////////////////////////////////////////////////// | 679 /////////////////////////////////////////////////////////////////////////////// |
| 684 // RenderViewHost, IPC message handlers: | 680 // RenderViewHost, IPC message handlers: |
| 685 | 681 |
| 686 void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { | 682 void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { |
| 687 #if defined(OS_WIN) | 683 #if defined(OS_WIN) |
| 688 // On Windows there's a potential deadlock with sync messsages going in | 684 // On Windows there's a potential deadlock with sync messsages going in |
| 689 // a circle from browser -> plugin -> renderer -> browser. | 685 // a circle from browser -> plugin -> renderer -> browser. |
| 690 // On Linux we can avoid this by avoiding sync messages from browser->plugin. | 686 // On Linux we can avoid this by avoiding sync messages from browser->plugin. |
| 691 // On Mac we avoid this by not supporting windowed plugins. | 687 // On Mac we avoid this by not supporting windowed plugins. |
| 692 if (msg.is_sync() && !msg.is_caller_pumping_messages()) { | 688 if (msg.is_sync() && !msg.is_caller_pumping_messages()) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionPostMessage, | 821 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionPostMessage, |
| 826 OnExtensionPostMessage) | 822 OnExtensionPostMessage) |
| 827 IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityFocusChange, | 823 IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityFocusChange, |
| 828 OnAccessibilityFocusChange) | 824 OnAccessibilityFocusChange) |
| 829 IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityObjectStateChange, | 825 IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityObjectStateChange, |
| 830 OnAccessibilityObjectStateChange) | 826 OnAccessibilityObjectStateChange) |
| 831 IPC_MESSAGE_HANDLER(ViewHostMsg_OnCSSInserted, OnCSSInserted) | 827 IPC_MESSAGE_HANDLER(ViewHostMsg_OnCSSInserted, OnCSSInserted) |
| 832 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) | 828 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) |
| 833 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) | 829 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) |
| 834 IPC_MESSAGE_HANDLER(ViewHostMsg_ContentBlocked, OnContentBlocked) | 830 IPC_MESSAGE_HANDLER(ViewHostMsg_ContentBlocked, OnContentBlocked) |
| 835 IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityTree, OnAccessibilityTree) | |
| 836 // Have the super handle all other messages. | 831 // Have the super handle all other messages. |
| 837 IPC_MESSAGE_UNHANDLED(RenderWidgetHost::OnMessageReceived(msg)) | 832 IPC_MESSAGE_UNHANDLED(RenderWidgetHost::OnMessageReceived(msg)) |
| 838 IPC_END_MESSAGE_MAP_EX() | 833 IPC_END_MESSAGE_MAP_EX() |
| 839 | 834 |
| 840 if (!msg_is_ok) { | 835 if (!msg_is_ok) { |
| 841 // The message had a handler, but its de-serialization failed. | 836 // The message had a handler, but its de-serialization failed. |
| 842 // Kill the renderer. | 837 // Kill the renderer. |
| 843 process()->ReceivedBadMessage(msg.type()); | 838 process()->ReceivedBadMessage(msg.type()); |
| 844 } | 839 } |
| 845 } | 840 } |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 | 1819 |
| 1825 void RenderViewHost::OnExtensionPostMessage( | 1820 void RenderViewHost::OnExtensionPostMessage( |
| 1826 int port_id, const std::string& message) { | 1821 int port_id, const std::string& message) { |
| 1827 if (process()->profile()->GetExtensionMessageService()) { | 1822 if (process()->profile()->GetExtensionMessageService()) { |
| 1828 process()->profile()->GetExtensionMessageService()-> | 1823 process()->profile()->GetExtensionMessageService()-> |
| 1829 PostMessageFromRenderer(port_id, message); | 1824 PostMessageFromRenderer(port_id, message); |
| 1830 } | 1825 } |
| 1831 } | 1826 } |
| 1832 | 1827 |
| 1833 void RenderViewHost::OnAccessibilityFocusChange(int acc_obj_id) { | 1828 void RenderViewHost::OnAccessibilityFocusChange(int acc_obj_id) { |
| 1834 view()->OnAccessibilityFocusChange(acc_obj_id); | 1829 #if defined(OS_WIN) |
| 1830 BrowserAccessibilityManager::GetInstance()->ChangeAccessibilityFocus( |
| 1831 acc_obj_id, process()->id(), routing_id()); |
| 1832 #else |
| 1833 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. |
| 1834 #endif |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 void RenderViewHost::OnAccessibilityObjectStateChange(int acc_obj_id) { | 1837 void RenderViewHost::OnAccessibilityObjectStateChange(int acc_obj_id) { |
| 1838 view()->OnAccessibilityObjectStateChange(acc_obj_id); | 1838 #if defined(OS_WIN) |
| 1839 } | 1839 BrowserAccessibilityManager::GetInstance()->OnAccessibilityObjectStateChange( |
| 1840 | 1840 acc_obj_id, process()->id(), routing_id()); |
| 1841 void RenderViewHost::OnAccessibilityTree( | 1841 #else |
| 1842 const webkit_glue::WebAccessibility& tree) { | 1842 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. |
| 1843 view()->UpdateAccessibilityTree(tree); | 1843 #endif |
| 1844 } | 1844 } |
| 1845 | 1845 |
| 1846 void RenderViewHost::OnCSSInserted() { | 1846 void RenderViewHost::OnCSSInserted() { |
| 1847 delegate_->DidInsertCSS(); | 1847 delegate_->DidInsertCSS(); |
| 1848 } | 1848 } |
| 1849 | 1849 |
| 1850 void RenderViewHost::OnPageContents(const GURL& url, | 1850 void RenderViewHost::OnPageContents(const GURL& url, |
| 1851 int32 page_id, | 1851 int32 page_id, |
| 1852 const std::wstring& contents, | 1852 const std::wstring& contents, |
| 1853 const std::string& language) { | 1853 const std::string& language) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1870 integration_delegate->OnPageTranslated(page_id, original_lang, | 1870 integration_delegate->OnPageTranslated(page_id, original_lang, |
| 1871 translated_lang, error_type); | 1871 translated_lang, error_type); |
| 1872 } | 1872 } |
| 1873 | 1873 |
| 1874 void RenderViewHost::OnContentBlocked(ContentSettingsType type) { | 1874 void RenderViewHost::OnContentBlocked(ContentSettingsType type) { |
| 1875 RenderViewHostDelegate::Resource* resource_delegate = | 1875 RenderViewHostDelegate::Resource* resource_delegate = |
| 1876 delegate_->GetResourceDelegate(); | 1876 delegate_->GetResourceDelegate(); |
| 1877 if (resource_delegate) | 1877 if (resource_delegate) |
| 1878 resource_delegate->OnContentBlocked(type); | 1878 resource_delegate->OnContentBlocked(type); |
| 1879 } | 1879 } |
| OLD | NEW |