| 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/browser/tab_contents/web_contents_view_win.h" | 5 #include "chrome/browser/tab_contents/web_contents_view_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 9 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
| 10 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. | 10 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/download/download_request_manager.h" | 12 #include "chrome/browser/download/download_request_manager.h" |
| 13 #include "chrome/browser/renderer_host/render_process_host.h" | 13 #include "chrome/browser/renderer_host/render_process_host.h" |
| 14 #include "chrome/browser/renderer_host/render_view_host.h" | 14 #include "chrome/browser/renderer_host/render_view_host.h" |
| 15 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 15 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
| 16 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 16 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 17 #include "chrome/browser/tab_contents/render_view_context_menu_controller.h" | 17 #include "chrome/browser/tab_contents/render_view_context_menu_controller.h" |
| 18 #include "chrome/browser/tab_contents/interstitial_page.h" | 18 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 19 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 19 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 20 #include "chrome/browser/tab_contents/web_contents.h" | 20 #include "chrome/browser/tab_contents/web_contents.h" |
| 21 #include "chrome/browser/tab_contents/web_drag_source.h" | 21 #include "chrome/browser/tab_contents/web_drag_source.h" |
| 22 #include "chrome/browser/tab_contents/web_drop_target.h" | 22 #include "chrome/browser/tab_contents/web_drop_target.h" |
| 23 #include "chrome/browser/views/sad_tab_view.h" | 23 #include "chrome/browser/views/sad_tab_view.h" |
| 24 #include "chrome/common/gfx/chrome_canvas.h" | 24 #include "chrome/common/gfx/chrome_canvas.h" |
| 25 #include "chrome/common/os_exchange_data.h" | 25 #include "chrome/common/os_exchange_data.h" |
| 26 #include "chrome/common/url_constants.h" |
| 26 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
| 27 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 28 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 28 #include "webkit/glue/webdropdata.h" | 29 #include "webkit/glue/webdropdata.h" |
| 29 #include "webkit/glue/webinputevent.h" | 30 #include "webkit/glue/webinputevent.h" |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 // Windows callback for OnDestroy to detach the plugin windows. | 34 // Windows callback for OnDestroy to detach the plugin windows. |
| 34 BOOL CALLBACK DetachPluginWindowsCallback(HWND window, LPARAM param) { | 35 BOOL CALLBACK DetachPluginWindowsCallback(HWND window, LPARAM param) { |
| 35 if (WebPluginDelegateImpl::IsPluginDelegateWindow(window) && | 36 if (WebPluginDelegateImpl::IsPluginDelegateWindow(window) && |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Retrieve the name from the URL. | 117 // Retrieve the name from the URL. |
| 117 file_name = FilePath::FromWStringHack( | 118 file_name = FilePath::FromWStringHack( |
| 118 net::GetSuggestedFilename(drop_data.url, L"", L"")); | 119 net::GetSuggestedFilename(drop_data.url, L"", L"")); |
| 119 } | 120 } |
| 120 file_name = file_name.ReplaceExtension(drop_data.file_extension); | 121 file_name = file_name.ReplaceExtension(drop_data.file_extension); |
| 121 data->SetFileContents(file_name.value(), drop_data.file_contents); | 122 data->SetFileContents(file_name.value(), drop_data.file_contents); |
| 122 } | 123 } |
| 123 if (!drop_data.text_html.empty()) | 124 if (!drop_data.text_html.empty()) |
| 124 data->SetHtml(drop_data.text_html, drop_data.html_base_url); | 125 data->SetHtml(drop_data.text_html, drop_data.html_base_url); |
| 125 if (drop_data.url.is_valid()) { | 126 if (drop_data.url.is_valid()) { |
| 126 if (drop_data.url.SchemeIs("javascript")) { | 127 if (drop_data.url.SchemeIs(chrome::kJavaScriptScheme)) { |
| 127 // We don't want to allow javascript URLs to be dragged to the desktop, | 128 // We don't want to allow javascript URLs to be dragged to the desktop, |
| 128 // but we do want to allow them to be added to the bookmarks bar | 129 // but we do want to allow them to be added to the bookmarks bar |
| 129 // (bookmarklets). | 130 // (bookmarklets). |
| 130 BookmarkDragData::Element bm_elt; | 131 BookmarkDragData::Element bm_elt; |
| 131 bm_elt.is_url = true; | 132 bm_elt.is_url = true; |
| 132 bm_elt.url = drop_data.url; | 133 bm_elt.url = drop_data.url; |
| 133 bm_elt.title = drop_data.url_title; | 134 bm_elt.title = drop_data.url_title; |
| 134 | 135 |
| 135 BookmarkDragData bm_drag_data; | 136 BookmarkDragData bm_drag_data; |
| 136 bm_drag_data.elements.push_back(bm_elt); | 137 bm_drag_data.elements.push_back(bm_elt); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 } | 601 } |
| 601 return false; | 602 return false; |
| 602 } | 603 } |
| 603 | 604 |
| 604 void WebContentsViewWin::WheelZoom(int distance) { | 605 void WebContentsViewWin::WheelZoom(int distance) { |
| 605 if (web_contents_->delegate()) { | 606 if (web_contents_->delegate()) { |
| 606 bool zoom_in = distance > 0; | 607 bool zoom_in = distance > 0; |
| 607 web_contents_->delegate()->ContentsZoomChange(zoom_in); | 608 web_contents_->delegate()->ContentsZoomChange(zoom_in); |
| 608 } | 609 } |
| 609 } | 610 } |
| OLD | NEW |