| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 #include "webkit/glue/media/simple_data_source.h" | 81 #include "webkit/glue/media/simple_data_source.h" |
| 82 #include "webkit/glue/password_form.h" | 82 #include "webkit/glue/password_form.h" |
| 83 #include "webkit/glue/plugins/plugin_list.h" | 83 #include "webkit/glue/plugins/plugin_list.h" |
| 84 #include "webkit/glue/searchable_form_data.h" | 84 #include "webkit/glue/searchable_form_data.h" |
| 85 #include "webkit/glue/webaccessibilitymanager_impl.h" | 85 #include "webkit/glue/webaccessibilitymanager_impl.h" |
| 86 #include "webkit/glue/webdevtoolsagent_delegate.h" | 86 #include "webkit/glue/webdevtoolsagent_delegate.h" |
| 87 #include "webkit/glue/webdropdata.h" | 87 #include "webkit/glue/webdropdata.h" |
| 88 #include "webkit/glue/webkit_glue.h" | 88 #include "webkit/glue/webkit_glue.h" |
| 89 #include "webkit/glue/webmediaplayer_impl.h" | 89 #include "webkit/glue/webmediaplayer_impl.h" |
| 90 #include "webkit/glue/webplugin_delegate.h" | 90 #include "webkit/glue/webplugin_delegate.h" |
| 91 #include "webkit/glue/webplugin_impl.h" |
| 91 #include "webkit/glue/webview.h" | 92 #include "webkit/glue/webview.h" |
| 92 | 93 |
| 93 #if defined(OS_WIN) | 94 #if defined(OS_WIN) |
| 94 // TODO(port): these files are currently Windows only because they concern: | 95 // TODO(port): these files are currently Windows only because they concern: |
| 95 // * theming | 96 // * theming |
| 96 #include "base/gfx/native_theme.h" | 97 #include "base/gfx/native_theme.h" |
| 97 #endif | 98 #endif |
| 98 | 99 |
| 99 using base::Time; | 100 using base::Time; |
| 100 using base::TimeDelta; | 101 using base::TimeDelta; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 : RenderWidget(render_thread, true), | 185 : RenderWidget(render_thread, true), |
| 185 enabled_bindings_(0), | 186 enabled_bindings_(0), |
| 186 target_url_status_(TARGET_NONE), | 187 target_url_status_(TARGET_NONE), |
| 187 is_loading_(false), | 188 is_loading_(false), |
| 188 navigation_gesture_(NavigationGestureUnknown), | 189 navigation_gesture_(NavigationGestureUnknown), |
| 189 page_id_(-1), | 190 page_id_(-1), |
| 190 last_page_id_sent_to_browser_(-1), | 191 last_page_id_sent_to_browser_(-1), |
| 191 last_indexed_page_id_(-1), | 192 last_indexed_page_id_(-1), |
| 192 opened_by_user_gesture_(true), | 193 opened_by_user_gesture_(true), |
| 193 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), | 194 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
| 194 first_default_plugin_(NULL), | |
| 195 devtools_agent_(NULL), | 195 devtools_agent_(NULL), |
| 196 devtools_client_(NULL), | 196 devtools_client_(NULL), |
| 197 history_back_list_count_(0), | 197 history_back_list_count_(0), |
| 198 history_forward_list_count_(0), | 198 history_forward_list_count_(0), |
| 199 has_unload_listener_(false), | 199 has_unload_listener_(false), |
| 200 decrement_shared_popup_at_destruction_(false), | 200 decrement_shared_popup_at_destruction_(false), |
| 201 form_field_autofill_request_id_(0), | 201 form_field_autofill_request_id_(0), |
| 202 popup_notification_visible_(false), | 202 popup_notification_visible_(false), |
| 203 delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync), | 203 delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync), |
| 204 preferred_width_(0), | 204 preferred_width_(0), |
| 205 send_preferred_width_changes_(false), | 205 send_preferred_width_changes_(false), |
| 206 determine_page_text_after_loading_stops_(false), | 206 determine_page_text_after_loading_stops_(false), |
| 207 view_type_(ViewType::INVALID), | 207 view_type_(ViewType::INVALID), |
| 208 browser_window_id_(-1), | 208 browser_window_id_(-1), |
| 209 last_top_level_navigation_page_id_(-1), | 209 last_top_level_navigation_page_id_(-1), |
| 210 webkit_preferences_(webkit_preferences) { | 210 webkit_preferences_(webkit_preferences) { |
| 211 Singleton<RenderViewSet>()->render_view_set_.insert(this); | 211 Singleton<RenderViewSet>()->render_view_set_.insert(this); |
| 212 } | 212 } |
| 213 | 213 |
| 214 RenderView::~RenderView() { | 214 RenderView::~RenderView() { |
| 215 Singleton<RenderViewSet>()->render_view_set_.erase(this); | 215 Singleton<RenderViewSet>()->render_view_set_.erase(this); |
| 216 if (decrement_shared_popup_at_destruction_) | 216 if (decrement_shared_popup_at_destruction_) |
| 217 shared_popup_counter_->data--; | 217 shared_popup_counter_->data--; |
| 218 | 218 |
| 219 // Clear any back-pointers that might still be held by plugins. | |
| 220 PluginDelegateList::iterator it = plugin_delegates_.begin(); | |
| 221 while (it != plugin_delegates_.end()) { | |
| 222 (*it)->DropRenderView(); | |
| 223 it = plugin_delegates_.erase(it); | |
| 224 } | |
| 225 | |
| 226 render_thread_->RemoveFilter(audio_message_filter_); | 219 render_thread_->RemoveFilter(audio_message_filter_); |
| 227 } | 220 } |
| 228 | 221 |
| 229 /*static*/ | 222 /*static*/ |
| 230 RenderView* RenderView::Create( | 223 RenderView* RenderView::Create( |
| 231 RenderThreadBase* render_thread, | 224 RenderThreadBase* render_thread, |
| 232 gfx::NativeViewId parent_hwnd, | 225 gfx::NativeViewId parent_hwnd, |
| 233 base::WaitableEvent* modal_dialog_event, | 226 base::WaitableEvent* modal_dialog_event, |
| 234 int32 opener_id, | 227 int32 opener_id, |
| 235 const RendererPreferences& renderer_prefs, | 228 const RendererPreferences& renderer_prefs, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 249 | 242 |
| 250 /*static*/ | 243 /*static*/ |
| 251 void RenderView::SetNextPageID(int32 next_page_id) { | 244 void RenderView::SetNextPageID(int32 next_page_id) { |
| 252 // This method should only be called during process startup, and the given | 245 // This method should only be called during process startup, and the given |
| 253 // page id had better not exceed our current next page id! | 246 // page id had better not exceed our current next page id! |
| 254 DCHECK_EQ(next_page_id_, 1); | 247 DCHECK_EQ(next_page_id_, 1); |
| 255 DCHECK(next_page_id >= next_page_id_); | 248 DCHECK(next_page_id >= next_page_id_); |
| 256 next_page_id_ = next_page_id; | 249 next_page_id_ = next_page_id; |
| 257 } | 250 } |
| 258 | 251 |
| 259 void RenderView::PluginDestroyed(WebPluginDelegateProxy* proxy) { | |
| 260 PluginDelegateList::iterator it = | |
| 261 std::find(plugin_delegates_.begin(), plugin_delegates_.end(), proxy); | |
| 262 DCHECK(it != plugin_delegates_.end()); | |
| 263 plugin_delegates_.erase(it); | |
| 264 // If the plugin is deleted, we need to clear our reference in case user | |
| 265 // clicks the info bar to install. Unfortunately we are getting | |
| 266 // PluginDestroyed in single process mode. However, that is not a huge | |
| 267 // concern. | |
| 268 if (proxy == first_default_plugin_) | |
| 269 first_default_plugin_ = NULL; | |
| 270 } | |
| 271 | |
| 272 void RenderView::PluginCrashed(base::ProcessId pid, | 252 void RenderView::PluginCrashed(base::ProcessId pid, |
| 273 const FilePath& plugin_path) { | 253 const FilePath& plugin_path) { |
| 274 Send(new ViewHostMsg_CrashedPlugin(routing_id_, pid, plugin_path)); | 254 Send(new ViewHostMsg_CrashedPlugin(routing_id_, pid, plugin_path)); |
| 275 } | 255 } |
| 276 | 256 |
| 277 | |
| 278 void RenderView::JSOutOfMemory() { | 257 void RenderView::JSOutOfMemory() { |
| 279 Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); | 258 Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); |
| 280 } | 259 } |
| 281 | 260 |
| 282 void RenderView::Init(gfx::NativeViewId parent_hwnd, | 261 void RenderView::Init(gfx::NativeViewId parent_hwnd, |
| 283 base::WaitableEvent* modal_dialog_event, | 262 base::WaitableEvent* modal_dialog_event, |
| 284 int32 opener_id, | 263 int32 opener_id, |
| 285 const RendererPreferences& renderer_prefs, | 264 const RendererPreferences& renderer_prefs, |
| 286 SharedRenderViewCounter* counter, | 265 SharedRenderViewCounter* counter, |
| 287 int32 routing_id) { | 266 int32 routing_id) { |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 | 1042 |
| 1064 void RenderView::DidStartLoading(WebView* webview) { | 1043 void RenderView::DidStartLoading(WebView* webview) { |
| 1065 if (is_loading_) { | 1044 if (is_loading_) { |
| 1066 DLOG(WARNING) << "DidStartLoading called while loading"; | 1045 DLOG(WARNING) << "DidStartLoading called while loading"; |
| 1067 return; | 1046 return; |
| 1068 } | 1047 } |
| 1069 | 1048 |
| 1070 is_loading_ = true; | 1049 is_loading_ = true; |
| 1071 // Clear the pointer so that we can assign it only when there is an unknown | 1050 // Clear the pointer so that we can assign it only when there is an unknown |
| 1072 // plugin on a page. | 1051 // plugin on a page. |
| 1073 first_default_plugin_ = NULL; | 1052 first_default_plugin_.reset(); |
| 1074 | 1053 |
| 1075 Send(new ViewHostMsg_DidStartLoading(routing_id_)); | 1054 Send(new ViewHostMsg_DidStartLoading(routing_id_)); |
| 1076 } | 1055 } |
| 1077 | 1056 |
| 1078 void RenderView::DidStopLoading(WebView* webview) { | 1057 void RenderView::DidStopLoading(WebView* webview) { |
| 1079 if (!is_loading_) { | 1058 if (!is_loading_) { |
| 1080 DLOG(WARNING) << "DidStopLoading called while not loading"; | 1059 DLOG(WARNING) << "DidStopLoading called while not loading"; |
| 1081 return; | 1060 return; |
| 1082 } | 1061 } |
| 1083 | 1062 |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1777 return; | 1756 return; |
| 1778 | 1757 |
| 1779 webview()->AutofillSuggestionsForNode(node_id, suggestions, | 1758 webview()->AutofillSuggestionsForNode(node_id, suggestions, |
| 1780 default_suggestion_index); | 1759 default_suggestion_index); |
| 1781 } | 1760 } |
| 1782 | 1761 |
| 1783 void RenderView::OnPopupNotificationVisibilityChanged(bool visible) { | 1762 void RenderView::OnPopupNotificationVisibilityChanged(bool visible) { |
| 1784 popup_notification_visible_ = visible; | 1763 popup_notification_visible_ = visible; |
| 1785 } | 1764 } |
| 1786 | 1765 |
| 1787 void RenderView::ShowModalHTMLDialog(const GURL& url, int width, int height, | |
| 1788 const std::string& json_arguments, | |
| 1789 std::string* json_retval) { | |
| 1790 IPC::SyncMessage* msg = new ViewHostMsg_ShowModalHTMLDialog( | |
| 1791 routing_id_, url, width, height, json_arguments, json_retval); | |
| 1792 | |
| 1793 msg->set_pump_messages_event(modal_dialog_event_.get()); | |
| 1794 Send(msg); | |
| 1795 } | |
| 1796 | |
| 1797 uint32 RenderView::GetCPBrowsingContext() { | 1766 uint32 RenderView::GetCPBrowsingContext() { |
| 1798 uint32 context = 0; | 1767 uint32 context = 0; |
| 1799 Send(new ViewHostMsg_GetCPBrowsingContext(&context)); | 1768 Send(new ViewHostMsg_GetCPBrowsingContext(&context)); |
| 1800 return context; | 1769 return context; |
| 1801 } | 1770 } |
| 1802 | 1771 |
| 1803 // Tell the browser to display a destination link. | 1772 // Tell the browser to display a destination link. |
| 1804 void RenderView::UpdateTargetURL(WebView* webview, const GURL& url) { | 1773 void RenderView::UpdateTargetURL(WebView* webview, const GURL& url) { |
| 1805 if (url != target_url_) { | 1774 if (url != target_url_) { |
| 1806 if (target_url_status_ == TARGET_INFLIGHT || | 1775 if (target_url_status_ == TARGET_INFLIGHT || |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 | 1873 |
| 1905 WebWidget* RenderView::CreatePopupWidgetWithInfo(WebView* webview, | 1874 WebWidget* RenderView::CreatePopupWidgetWithInfo(WebView* webview, |
| 1906 const WebPopupMenuInfo& info) { | 1875 const WebPopupMenuInfo& info) { |
| 1907 RenderWidget* widget = RenderWidget::Create(routing_id_, | 1876 RenderWidget* widget = RenderWidget::Create(routing_id_, |
| 1908 render_thread_, | 1877 render_thread_, |
| 1909 true); | 1878 true); |
| 1910 widget->ConfigureAsExternalPopupMenu(info); | 1879 widget->ConfigureAsExternalPopupMenu(info); |
| 1911 return widget->webwidget(); | 1880 return widget->webwidget(); |
| 1912 } | 1881 } |
| 1913 | 1882 |
| 1914 WebPluginDelegate* RenderView::CreatePluginDelegate( | 1883 WebKit::WebPlugin* RenderView::CreatePlugin( |
| 1915 WebView* webview, | 1884 WebFrame* frame, const WebKit::WebPluginParams& params) { |
| 1916 const GURL& url, | 1885 return new webkit_glue::WebPluginImpl(frame, params, AsWeakPtr()); |
| 1917 const std::string& mime_type, | |
| 1918 const std::string& clsid, | |
| 1919 std::string* actual_mime_type) { | |
| 1920 if (!PluginChannelHost::IsListening()) | |
| 1921 return NULL; | |
| 1922 | |
| 1923 GURL policy_url; | |
| 1924 if (webview->GetMainFrame()) | |
| 1925 policy_url = webview->GetMainFrame()->url(); | |
| 1926 | |
| 1927 FilePath path; | |
| 1928 render_thread_->Send( | |
| 1929 new ViewHostMsg_GetPluginPath(url, policy_url, mime_type, clsid, &path, | |
| 1930 actual_mime_type)); | |
| 1931 if (path.value().empty()) | |
| 1932 return NULL; | |
| 1933 | |
| 1934 std::string mime_type_to_use; | |
| 1935 if (!actual_mime_type->empty()) | |
| 1936 mime_type_to_use = *actual_mime_type; | |
| 1937 else | |
| 1938 mime_type_to_use = mime_type; | |
| 1939 | |
| 1940 if (RenderProcess::current()->in_process_plugins()) { | |
| 1941 #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac. | |
| 1942 return WebPluginDelegate::Create(path, | |
| 1943 mime_type_to_use, | |
| 1944 gfx::NativeViewFromId(host_window_)); | |
| 1945 #else | |
| 1946 NOTIMPLEMENTED(); | |
| 1947 return NULL; | |
| 1948 #endif | |
| 1949 } | |
| 1950 | |
| 1951 WebPluginDelegateProxy* proxy = | |
| 1952 WebPluginDelegateProxy::Create(url, mime_type_to_use, clsid, this); | |
| 1953 if (!proxy) | |
| 1954 return NULL; | |
| 1955 | |
| 1956 plugin_delegates_.push_back(proxy); | |
| 1957 | |
| 1958 return proxy; | |
| 1959 } | 1886 } |
| 1960 | 1887 |
| 1961 WebKit::WebMediaPlayer* RenderView::CreateWebMediaPlayer( | 1888 WebKit::WebMediaPlayer* RenderView::CreateWebMediaPlayer( |
| 1962 WebKit::WebMediaPlayerClient* client) { | 1889 WebKit::WebMediaPlayerClient* client) { |
| 1963 scoped_refptr<media::FilterFactoryCollection> factory = | 1890 scoped_refptr<media::FilterFactoryCollection> factory = |
| 1964 new media::FilterFactoryCollection(); | 1891 new media::FilterFactoryCollection(); |
| 1965 // Add in any custom filter factories first. | 1892 // Add in any custom filter factories first. |
| 1966 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 1893 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 1967 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 1894 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
| 1968 // Add the chrome specific audio renderer. | 1895 // Add the chrome specific audio renderer. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1986 webkit_glue::BufferedDataSource::CreateFactory(MessageLoop::current(), | 1913 webkit_glue::BufferedDataSource::CreateFactory(MessageLoop::current(), |
| 1987 bridge_factory)); | 1914 bridge_factory)); |
| 1988 } else { | 1915 } else { |
| 1989 factory->AddFactory( | 1916 factory->AddFactory( |
| 1990 webkit_glue::SimpleDataSource::CreateFactory(MessageLoop::current(), | 1917 webkit_glue::SimpleDataSource::CreateFactory(MessageLoop::current(), |
| 1991 bridge_factory)); | 1918 bridge_factory)); |
| 1992 } | 1919 } |
| 1993 return new webkit_glue::WebMediaPlayerImpl(client, factory); | 1920 return new webkit_glue::WebMediaPlayerImpl(client, factory); |
| 1994 } | 1921 } |
| 1995 | 1922 |
| 1996 void RenderView::OnMissingPluginStatus(WebPluginDelegate* delegate, | 1923 void RenderView::OnMissingPluginStatus( |
| 1997 int status) { | 1924 WebPluginDelegateProxy* delegate, |
| 1925 int status) { |
| 1998 #if defined(OS_WIN) | 1926 #if defined(OS_WIN) |
| 1999 if (first_default_plugin_ == NULL) { | 1927 if (!first_default_plugin_) { |
| 2000 // Show the InfoBar for the first available plugin. | 1928 // Show the InfoBar for the first available plugin. |
| 2001 if (status == default_plugin::MISSING_PLUGIN_AVAILABLE) { | 1929 if (status == default_plugin::MISSING_PLUGIN_AVAILABLE) { |
| 2002 first_default_plugin_ = delegate; | 1930 first_default_plugin_ = delegate->AsWeakPtr(); |
| 2003 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); | 1931 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); |
| 2004 } | 1932 } |
| 2005 } else { | 1933 } else { |
| 2006 // Closes the InfoBar if user clicks on the plugin (instead of the InfoBar) | 1934 // Closes the InfoBar if user clicks on the plugin (instead of the InfoBar) |
| 2007 // to start the download/install. | 1935 // to start the download/install. |
| 2008 if (status == default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD) { | 1936 if (status == default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD) { |
| 2009 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); | 1937 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); |
| 2010 } | 1938 } |
| 2011 } | 1939 } |
| 2012 #else | 1940 #else |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2080 | 2008 |
| 2081 void RenderView::runModal() { | 2009 void RenderView::runModal() { |
| 2082 DCHECK(did_show_) << "should already have shown the view"; | 2010 DCHECK(did_show_) << "should already have shown the view"; |
| 2083 | 2011 |
| 2084 IPC::SyncMessage* msg = new ViewHostMsg_RunModal(routing_id_); | 2012 IPC::SyncMessage* msg = new ViewHostMsg_RunModal(routing_id_); |
| 2085 | 2013 |
| 2086 msg->set_pump_messages_event(modal_dialog_event_.get()); | 2014 msg->set_pump_messages_event(modal_dialog_event_.get()); |
| 2087 Send(msg); | 2015 Send(msg); |
| 2088 } | 2016 } |
| 2089 | 2017 |
| 2018 webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate( |
| 2019 const GURL& url, |
| 2020 const std::string& mime_type, |
| 2021 const std::string& clsid, |
| 2022 std::string* actual_mime_type) { |
| 2023 if (!PluginChannelHost::IsListening()) |
| 2024 return NULL; |
| 2025 |
| 2026 GURL policy_url; |
| 2027 WebFrame* main_frame = webview()->GetMainFrame(); |
| 2028 if (main_frame) |
| 2029 policy_url = main_frame->url(); |
| 2030 |
| 2031 FilePath path; |
| 2032 render_thread_->Send( |
| 2033 new ViewHostMsg_GetPluginPath(url, policy_url, mime_type, clsid, &path, |
| 2034 actual_mime_type)); |
| 2035 if (path.value().empty()) |
| 2036 return NULL; |
| 2037 |
| 2038 const std::string* mime_type_to_use; |
| 2039 if (!actual_mime_type->empty()) |
| 2040 mime_type_to_use = actual_mime_type; |
| 2041 else |
| 2042 mime_type_to_use = &mime_type; |
| 2043 |
| 2044 if (RenderProcess::current()->in_process_plugins()) { |
| 2045 #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac. |
| 2046 return webkit_glue::WebPluginDelegate::Create( |
| 2047 path, *mime_type_to_use, gfx::NativeViewFromId(host_window_)); |
| 2048 #else |
| 2049 NOTIMPLEMENTED(); |
| 2050 return NULL; |
| 2051 #endif |
| 2052 } |
| 2053 |
| 2054 return WebPluginDelegateProxy::Create( |
| 2055 url, *mime_type_to_use, clsid, AsWeakPtr()); |
| 2056 } |
| 2057 |
| 2058 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) { |
| 2059 #if defined(OS_LINUX) |
| 2060 RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer( |
| 2061 routing_id(), window)); |
| 2062 #endif |
| 2063 } |
| 2064 |
| 2065 void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) { |
| 2066 #if defined(OS_LINUX) |
| 2067 RenderThread::current()->Send(new ViewHostMsg_DestroyPluginContainer( |
| 2068 routing_id(), window)); |
| 2069 #endif |
| 2070 CleanupWindowInPluginMoves(window); |
| 2071 } |
| 2072 |
| 2073 void RenderView::DidMovePlugin(const webkit_glue::WebPluginGeometry& move) { |
| 2074 SchedulePluginMove(move); |
| 2075 } |
| 2076 |
| 2077 void RenderView::DidStartLoadingForPlugin() { |
| 2078 // TODO(darin): Make is_loading_ be a counter! |
| 2079 DidStartLoading(webview()); |
| 2080 } |
| 2081 |
| 2082 void RenderView::DidStopLoadingForPlugin() { |
| 2083 // TODO(darin): Make is_loading_ be a counter! |
| 2084 DidStopLoading(webview()); |
| 2085 } |
| 2086 |
| 2087 void RenderView::ShowModalHTMLDialogForPlugin( |
| 2088 const GURL& url, |
| 2089 const gfx::Size& size, |
| 2090 const std::string& json_arguments, |
| 2091 std::string* json_retval) { |
| 2092 IPC::SyncMessage* msg = new ViewHostMsg_ShowModalHTMLDialog( |
| 2093 routing_id_, url, size.width(), size.height(), json_arguments, |
| 2094 json_retval); |
| 2095 |
| 2096 msg->set_pump_messages_event(modal_dialog_event_.get()); |
| 2097 Send(msg); |
| 2098 } |
| 2099 |
| 2090 void RenderView::SyncNavigationState() { | 2100 void RenderView::SyncNavigationState() { |
| 2091 if (!webview()) | 2101 if (!webview()) |
| 2092 return; | 2102 return; |
| 2093 | 2103 |
| 2094 const WebHistoryItem& item = webview()->GetMainFrame()->currentHistoryItem(); | 2104 const WebHistoryItem& item = webview()->GetMainFrame()->currentHistoryItem(); |
| 2095 if (item.isNull()) | 2105 if (item.isNull()) |
| 2096 return; | 2106 return; |
| 2097 | 2107 |
| 2098 Send(new ViewHostMsg_UpdateState( | 2108 Send(new ViewHostMsg_UpdateState( |
| 2099 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); | 2109 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2735 webkit_preferences_ = prefs; | 2745 webkit_preferences_ = prefs; |
| 2736 webkit_preferences_.Apply(webview()); | 2746 webkit_preferences_.Apply(webview()); |
| 2737 } | 2747 } |
| 2738 | 2748 |
| 2739 void RenderView::OnSetAltErrorPageURL(const GURL& url) { | 2749 void RenderView::OnSetAltErrorPageURL(const GURL& url) { |
| 2740 alternate_error_page_url_ = url; | 2750 alternate_error_page_url_ = url; |
| 2741 } | 2751 } |
| 2742 | 2752 |
| 2743 void RenderView::OnInstallMissingPlugin() { | 2753 void RenderView::OnInstallMissingPlugin() { |
| 2744 // This could happen when the first default plugin is deleted. | 2754 // This could happen when the first default plugin is deleted. |
| 2745 if (first_default_plugin_ == NULL) | 2755 if (first_default_plugin_) |
| 2746 return; | 2756 first_default_plugin_->InstallMissingPlugin(); |
| 2747 first_default_plugin_->InstallMissingPlugin(); | |
| 2748 } | 2757 } |
| 2749 | 2758 |
| 2750 void RenderView::OnFileChooserResponse( | 2759 void RenderView::OnFileChooserResponse( |
| 2751 const std::vector<FilePath>& file_names) { | 2760 const std::vector<FilePath>& file_names) { |
| 2752 // This could happen if we navigated to a different page before the user | 2761 // This could happen if we navigated to a different page before the user |
| 2753 // closed the chooser. | 2762 // closed the chooser. |
| 2754 if (!file_chooser_.get()) | 2763 if (!file_chooser_.get()) |
| 2755 return; | 2764 return; |
| 2756 | 2765 |
| 2757 file_chooser_->OnFileChoose(file_names); | 2766 file_chooser_->OnFileChoose(file_names); |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3290 // occurred. | 3299 // occurred. |
| 3291 if (acc_obj_id >= 0) | 3300 if (acc_obj_id >= 0) |
| 3292 Send(new ViewHostMsg_AccessibilityFocusChange(routing_id_, acc_obj_id)); | 3301 Send(new ViewHostMsg_AccessibilityFocusChange(routing_id_, acc_obj_id)); |
| 3293 | 3302 |
| 3294 #else // defined(OS_WIN) | 3303 #else // defined(OS_WIN) |
| 3295 // TODO(port): accessibility not yet implemented | 3304 // TODO(port): accessibility not yet implemented |
| 3296 NOTIMPLEMENTED(); | 3305 NOTIMPLEMENTED(); |
| 3297 #endif | 3306 #endif |
| 3298 } | 3307 } |
| 3299 | 3308 |
| 3300 void RenderView::DidMovePlugin(const WebPluginGeometry& move) { | |
| 3301 SchedulePluginMove(move); | |
| 3302 } | |
| 3303 | |
| 3304 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) { | |
| 3305 #if defined(OS_LINUX) | |
| 3306 RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer( | |
| 3307 routing_id(), window)); | |
| 3308 #endif | |
| 3309 } | |
| 3310 | |
| 3311 void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) { | |
| 3312 #if defined(OS_LINUX) | |
| 3313 RenderThread::current()->Send(new ViewHostMsg_DestroyPluginContainer( | |
| 3314 routing_id(), window)); | |
| 3315 #endif | |
| 3316 CleanupWindowInPluginMoves(window); | |
| 3317 } | |
| 3318 | |
| 3319 void RenderView::SendPasswordForms(WebFrame* frame) { | 3309 void RenderView::SendPasswordForms(WebFrame* frame) { |
| 3320 WebVector<WebForm> forms; | 3310 WebVector<WebForm> forms; |
| 3321 frame->forms(forms); | 3311 frame->forms(forms); |
| 3322 | 3312 |
| 3323 std::vector<PasswordForm> password_forms; | 3313 std::vector<PasswordForm> password_forms; |
| 3324 for (size_t i = 0; i < forms.size(); ++i) { | 3314 for (size_t i = 0; i < forms.size(); ++i) { |
| 3325 const WebForm& form = forms[i]; | 3315 const WebForm& form = forms[i]; |
| 3326 | 3316 |
| 3327 // Respect autocomplete=off. | 3317 // Respect autocomplete=off. |
| 3328 if (form.isAutoCompleteEnabled()) { | 3318 if (form.isAutoCompleteEnabled()) { |
| 3329 scoped_ptr<PasswordForm> password_form( | 3319 scoped_ptr<PasswordForm> password_form( |
| 3330 PasswordFormDomManager::CreatePasswordForm(form)); | 3320 PasswordFormDomManager::CreatePasswordForm(form)); |
| 3331 if (password_form.get()) | 3321 if (password_form.get()) |
| 3332 password_forms.push_back(*password_form); | 3322 password_forms.push_back(*password_form); |
| 3333 } | 3323 } |
| 3334 } | 3324 } |
| 3335 | 3325 |
| 3336 if (!password_forms.empty()) | 3326 if (!password_forms.empty()) |
| 3337 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); | 3327 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); |
| 3338 } | 3328 } |
| 3339 | 3329 |
| 3340 void RenderView::Print(WebFrame* frame, bool script_initiated) { | 3330 void RenderView::Print(WebFrame* frame, bool script_initiated) { |
| 3341 DCHECK(frame); | 3331 DCHECK(frame); |
| 3342 if (print_helper_.get() == NULL) { | 3332 if (print_helper_.get() == NULL) { |
| 3343 print_helper_.reset(new PrintWebViewHelper(this)); | 3333 print_helper_.reset(new PrintWebViewHelper(this)); |
| 3344 } | 3334 } |
| 3345 print_helper_->Print(frame, script_initiated); | 3335 print_helper_->Print(frame, script_initiated); |
| 3346 } | 3336 } |
| OLD | NEW |