| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "webkit/glue/webkit_glue.h" | 59 #include "webkit/glue/webkit_glue.h" |
| 60 #include "webkit/glue/webpreferences.h" | 60 #include "webkit/glue/webpreferences.h" |
| 61 #include "webkit/glue/webplugin_delegate.h" | 61 #include "webkit/glue/webplugin_delegate.h" |
| 62 #include "webkit/glue/webresponse.h" | 62 #include "webkit/glue/webresponse.h" |
| 63 #include "webkit/glue/weburlrequest.h" | 63 #include "webkit/glue/weburlrequest.h" |
| 64 #include "webkit/glue/webview.h" | 64 #include "webkit/glue/webview.h" |
| 65 | 65 |
| 66 #if defined(OS_WIN) | 66 #if defined(OS_WIN) |
| 67 // TODO(port): these files are currently Windows only because they concern: | 67 // TODO(port): these files are currently Windows only because they concern: |
| 68 // * logging | 68 // * logging |
| 69 // * plugins | |
| 70 // * printing | 69 // * printing |
| 71 // * theming | 70 // * theming |
| 72 // * views | 71 // * views |
| 73 #include "base/gfx/gdi_util.h" | 72 #include "base/gfx/gdi_util.h" |
| 74 #include "base/gfx/native_theme.h" | 73 #include "base/gfx/native_theme.h" |
| 75 #include "chrome/common/gfx/emf.h" | 74 #include "chrome/common/gfx/emf.h" |
| 76 #include "chrome/renderer/renderer_logging.h" | 75 #include "chrome/renderer/renderer_logging.h" |
| 77 #include "chrome/views/message_box_view.h" | 76 #include "chrome/views/message_box_view.h" |
| 78 #include "chrome/common/chrome_plugin_lib.h" | |
| 79 #include "chrome/renderer/chrome_plugin_host.h" | |
| 80 #include "skia/ext/vector_canvas.h" | 77 #include "skia/ext/vector_canvas.h" |
| 81 #endif | 78 #endif |
| 82 | 79 |
| 83 #if defined(OS_WIN) | 80 #if defined(OS_WIN) |
| 84 // If true, the URL of the active renderer is logged. Logging is done in such | 81 // If true, the URL of the active renderer is logged. Logging is done in such |
| 85 // way that if the renderer crashes the URL of the active renderer is contained | 82 // way that if the renderer crashes the URL of the active renderer is contained |
| 86 // in the dump. Currently mini-dumps are only supported on windows, so this is | 83 // in the dump. Currently mini-dumps are only supported on windows, so this is |
| 87 // only enabled on windows. | 84 // only enabled on windows. |
| 88 #define LOG_RENDERER_URL | 85 #define LOG_RENDERER_URL |
| 89 #endif | 86 #endif |
| (...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 } | 1859 } |
| 1863 | 1860 |
| 1864 WebWidget* RenderView::CreatePopupWidget(WebView* webview, | 1861 WebWidget* RenderView::CreatePopupWidget(WebView* webview, |
| 1865 bool activatable) { | 1862 bool activatable) { |
| 1866 RenderWidget* widget = RenderWidget::Create(routing_id_, | 1863 RenderWidget* widget = RenderWidget::Create(routing_id_, |
| 1867 render_thread_, | 1864 render_thread_, |
| 1868 activatable); | 1865 activatable); |
| 1869 return widget->webwidget(); | 1866 return widget->webwidget(); |
| 1870 } | 1867 } |
| 1871 | 1868 |
| 1872 #if defined(OS_WIN) | |
| 1873 // TODO(port): This is only used on Windows since the plugin code is #ifdefed | |
| 1874 // out for other platforms currently | |
| 1875 | |
| 1876 static bool ShouldLoadPluginInProcess(const std::string& mime_type, | |
| 1877 bool* is_gears) { | |
| 1878 if (RenderProcess::current()->in_process_plugins()) | |
| 1879 return true; | |
| 1880 | |
| 1881 if (mime_type == "application/x-googlegears") { | |
| 1882 *is_gears = true; | |
| 1883 return RenderProcess::current()->in_process_gears(); | |
| 1884 } | |
| 1885 | |
| 1886 return false; | |
| 1887 } | |
| 1888 #endif | |
| 1889 | |
| 1890 WebPluginDelegate* RenderView::CreatePluginDelegate( | 1869 WebPluginDelegate* RenderView::CreatePluginDelegate( |
| 1891 WebView* webview, | 1870 WebView* webview, |
| 1892 const GURL& url, | 1871 const GURL& url, |
| 1893 const std::string& mime_type, | 1872 const std::string& mime_type, |
| 1894 const std::string& clsid, | 1873 const std::string& clsid, |
| 1895 std::string* actual_mime_type) { | 1874 std::string* actual_mime_type) { |
| 1896 #if defined(OS_WIN) | 1875 #if defined(OS_WIN) |
| 1897 bool is_gears = false; | 1876 if (RenderProcess::current()->in_process_plugins()) { |
| 1898 if (ShouldLoadPluginInProcess(mime_type, &is_gears)) { | |
| 1899 FilePath path; | 1877 FilePath path; |
| 1900 render_thread_->Send( | 1878 render_thread_->Send( |
| 1901 new ViewHostMsg_GetPluginPath(url, mime_type, clsid, &path, | 1879 new ViewHostMsg_GetPluginPath(url, mime_type, clsid, &path, |
| 1902 actual_mime_type)); | 1880 actual_mime_type)); |
| 1903 if (path.value().empty()) | 1881 if (path.value().empty()) |
| 1904 return NULL; | 1882 return NULL; |
| 1905 | 1883 |
| 1906 std::string mime_type_to_use; | 1884 std::string mime_type_to_use; |
| 1907 if (actual_mime_type && !actual_mime_type->empty()) | 1885 if (actual_mime_type && !actual_mime_type->empty()) |
| 1908 mime_type_to_use = *actual_mime_type; | 1886 mime_type_to_use = *actual_mime_type; |
| 1909 else | 1887 else |
| 1910 mime_type_to_use = mime_type; | 1888 mime_type_to_use = mime_type; |
| 1911 | 1889 |
| 1912 if (is_gears) | |
| 1913 ChromePluginLib::Create(path, GetCPBrowserFuncsForRenderer()); | |
| 1914 return WebPluginDelegate::Create(path, | 1890 return WebPluginDelegate::Create(path, |
| 1915 mime_type_to_use, | 1891 mime_type_to_use, |
| 1916 gfx::NativeViewFromId(host_window_)); | 1892 gfx::NativeViewFromId(host_window_)); |
| 1917 } | 1893 } |
| 1918 | 1894 |
| 1919 WebPluginDelegateProxy* proxy = | 1895 WebPluginDelegateProxy* proxy = |
| 1920 WebPluginDelegateProxy::Create(url, mime_type, clsid, this); | 1896 WebPluginDelegateProxy::Create(url, mime_type, clsid, this); |
| 1921 if (!proxy) | 1897 if (!proxy) |
| 1922 return NULL; | 1898 return NULL; |
| 1923 | 1899 |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2969 DCHECK(audio_renderers_.Lookup(stream_id) != NULL); | 2945 DCHECK(audio_renderers_.Lookup(stream_id) != NULL); |
| 2970 Send(new ViewHostMsg_SetAudioVolume(routing_id_, stream_id, left, right)); | 2946 Send(new ViewHostMsg_SetAudioVolume(routing_id_, stream_id, left, right)); |
| 2971 } | 2947 } |
| 2972 | 2948 |
| 2973 void RenderView::OnResize(const gfx::Size& new_size, | 2949 void RenderView::OnResize(const gfx::Size& new_size, |
| 2974 const gfx::Rect& resizer_rect) { | 2950 const gfx::Rect& resizer_rect) { |
| 2975 if (webview()) | 2951 if (webview()) |
| 2976 webview()->HideAutofillPopup(); | 2952 webview()->HideAutofillPopup(); |
| 2977 RenderWidget::OnResize(new_size, resizer_rect); | 2953 RenderWidget::OnResize(new_size, resizer_rect); |
| 2978 } | 2954 } |
| OLD | NEW |