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/browser_plugin/browser_plugin_manager_impl.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" |
6 | 6 |
7 #include "content/common/browser_plugin_messages.h" | 7 #include "content/common/browser_plugin_messages.h" |
8 #include "content/renderer/browser_plugin/browser_plugin.h" | 8 #include "content/renderer/browser_plugin/browser_plugin.h" |
9 #include "content/renderer/render_thread_impl.h" | 9 #include "content/renderer/render_thread_impl.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 return RenderThread::Get()->Send(msg); | 30 return RenderThread::Get()->Send(msg); |
31 } | 31 } |
32 | 32 |
33 bool BrowserPluginManagerImpl::OnControlMessageReceived( | 33 bool BrowserPluginManagerImpl::OnControlMessageReceived( |
34 const IPC::Message& message) { | 34 const IPC::Message& message) { |
35 DCHECK(CalledOnValidThread()); | 35 DCHECK(CalledOnValidThread()); |
36 bool handled = true; | 36 bool handled = true; |
37 IPC_BEGIN_MESSAGE_MAP(BrowserPluginManagerImpl, message) | 37 IPC_BEGIN_MESSAGE_MAP(BrowserPluginManagerImpl, message) |
38 IPC_MESSAGE_HANDLER(BrowserPluginMsg_UpdateRect, OnUpdateRect) | 38 IPC_MESSAGE_HANDLER(BrowserPluginMsg_UpdateRect, OnUpdateRect) |
39 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestCrashed, OnGuestCrashed) | 39 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestCrashed, OnGuestCrashed) |
40 IPC_MESSAGE_HANDLER(BrowserPluginMsg_DidNavigate, OnDidNavigate) | |
41 IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus) | 40 IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus) |
42 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestContentWindowReady, | 41 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestContentWindowReady, |
43 OnGuestContentWindowReady) | 42 OnGuestContentWindowReady) |
44 IPC_MESSAGE_HANDLER(BrowserPluginMsg_ShouldAcceptTouchEvents, | 43 IPC_MESSAGE_HANDLER(BrowserPluginMsg_ShouldAcceptTouchEvents, |
45 OnShouldAcceptTouchEvents) | 44 OnShouldAcceptTouchEvents) |
46 IPC_MESSAGE_HANDLER(BrowserPluginMsg_LoadStart, OnLoadStart) | 45 IPC_MESSAGE_HANDLER(BrowserPluginMsg_LoadStart, OnLoadStart) |
47 IPC_MESSAGE_HANDLER(BrowserPluginMsg_LoadAbort, OnLoadAbort) | 46 IPC_MESSAGE_HANDLER(BrowserPluginMsg_LoadAbort, OnLoadAbort) |
48 IPC_MESSAGE_HANDLER(BrowserPluginMsg_LoadRedirect, OnLoadRedirect) | 47 IPC_MESSAGE_HANDLER(BrowserPluginMsg_LoadRedirect, OnLoadRedirect) |
| 48 IPC_MESSAGE_HANDLER(BrowserPluginMsg_LoadCommit, OnLoadCommit) |
| 49 IPC_MESSAGE_HANDLER(BrowserPluginMsg_LoadStop, OnLoadStop) |
49 IPC_MESSAGE_UNHANDLED(handled = false) | 50 IPC_MESSAGE_UNHANDLED(handled = false) |
50 IPC_END_MESSAGE_MAP() | 51 IPC_END_MESSAGE_MAP() |
51 return handled; | 52 return handled; |
52 } | 53 } |
53 | 54 |
54 void BrowserPluginManagerImpl::OnUpdateRect( | 55 void BrowserPluginManagerImpl::OnUpdateRect( |
55 int instance_id, | 56 int instance_id, |
56 int message_id, | 57 int message_id, |
57 const BrowserPluginMsg_UpdateRect_Params& params) { | 58 const BrowserPluginMsg_UpdateRect_Params& params) { |
58 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 59 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
59 if (plugin) | 60 if (plugin) |
60 plugin->UpdateRect(message_id, params); | 61 plugin->UpdateRect(message_id, params); |
61 } | 62 } |
62 | 63 |
63 void BrowserPluginManagerImpl::OnGuestCrashed(int instance_id) { | 64 void BrowserPluginManagerImpl::OnGuestCrashed(int instance_id) { |
64 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 65 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
65 if (plugin) | 66 if (plugin) |
66 plugin->GuestCrashed(); | 67 plugin->GuestCrashed(); |
67 } | 68 } |
68 | 69 |
69 void BrowserPluginManagerImpl::OnDidNavigate( | |
70 int instance_id, | |
71 const BrowserPluginMsg_DidNavigate_Params& params) { | |
72 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | |
73 if (plugin) | |
74 plugin->DidNavigate(params); | |
75 } | |
76 | |
77 void BrowserPluginManagerImpl::OnAdvanceFocus(int instance_id, bool reverse) { | 70 void BrowserPluginManagerImpl::OnAdvanceFocus(int instance_id, bool reverse) { |
78 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 71 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
79 if (plugin) | 72 if (plugin) |
80 plugin->AdvanceFocus(reverse); | 73 plugin->AdvanceFocus(reverse); |
81 } | 74 } |
82 | 75 |
83 void BrowserPluginManagerImpl::OnGuestContentWindowReady(int instance_id, | 76 void BrowserPluginManagerImpl::OnGuestContentWindowReady(int instance_id, |
84 int guest_routing_id) { | 77 int guest_routing_id) { |
85 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 78 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
86 if (plugin) | 79 if (plugin) |
87 plugin->GuestContentWindowReady(guest_routing_id); | 80 plugin->GuestContentWindowReady(guest_routing_id); |
88 } | 81 } |
89 | 82 |
90 void BrowserPluginManagerImpl::OnShouldAcceptTouchEvents(int instance_id, | 83 void BrowserPluginManagerImpl::OnShouldAcceptTouchEvents(int instance_id, |
91 bool accept) { | 84 bool accept) { |
92 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 85 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
93 if (plugin) | 86 if (plugin) |
94 plugin->SetAcceptTouchEvents(accept); | 87 plugin->SetAcceptTouchEvents(accept); |
95 } | 88 } |
96 | 89 |
97 void BrowserPluginManagerImpl::OnLoadStart(int instance_id, | 90 void BrowserPluginManagerImpl::OnLoadStart(int instance_id, |
98 const GURL& url, | 91 const GURL& url, |
99 bool is_top_level) { | 92 bool is_top_level) { |
100 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 93 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
101 if (plugin) | 94 if (plugin) |
102 plugin->LoadStart(url, is_top_level); | 95 plugin->LoadStart(url, is_top_level); |
103 } | 96 } |
104 | 97 |
| 98 void BrowserPluginManagerImpl::OnLoadCommit( |
| 99 int instance_id, |
| 100 const BrowserPluginMsg_LoadCommit_Params& params) { |
| 101 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
| 102 if (plugin) |
| 103 plugin->LoadCommit(params); |
| 104 } |
| 105 |
| 106 void BrowserPluginManagerImpl::OnLoadStop(int instance_id) { |
| 107 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
| 108 if (plugin) |
| 109 plugin->LoadStop(); |
| 110 } |
| 111 |
105 void BrowserPluginManagerImpl::OnLoadAbort(int instance_id, | 112 void BrowserPluginManagerImpl::OnLoadAbort(int instance_id, |
106 const GURL& url, | 113 const GURL& url, |
107 bool is_top_level, | 114 bool is_top_level, |
108 const std::string& type) { | 115 const std::string& type) { |
109 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 116 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
110 if (plugin) | 117 if (plugin) |
111 plugin->LoadAbort(url, is_top_level, type); | 118 plugin->LoadAbort(url, is_top_level, type); |
112 } | 119 } |
113 | 120 |
114 void BrowserPluginManagerImpl::OnLoadRedirect(int instance_id, | 121 void BrowserPluginManagerImpl::OnLoadRedirect(int instance_id, |
115 const GURL& old_url, | 122 const GURL& old_url, |
116 const GURL& new_url, | 123 const GURL& new_url, |
117 bool is_top_level) { | 124 bool is_top_level) { |
118 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 125 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
119 if (plugin) | 126 if (plugin) |
120 plugin->LoadRedirect(old_url, new_url, is_top_level); | 127 plugin->LoadRedirect(old_url, new_url, is_top_level); |
121 } | 128 } |
122 | 129 |
123 } // namespace content | 130 } // namespace content |
OLD | NEW |