| 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/tab_contents_view_win.h" | 5 #include "chrome/browser/tab_contents/tab_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. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // contents (to a .URL shortcut). We want to prefer file content data over a | 126 // contents (to a .URL shortcut). We want to prefer file content data over a |
| 127 // shortcut so we add it first. | 127 // shortcut so we add it first. |
| 128 if (!drop_data.file_contents.empty()) { | 128 if (!drop_data.file_contents.empty()) { |
| 129 // Images without ALT text will only have a file extension so we need to | 129 // Images without ALT text will only have a file extension so we need to |
| 130 // synthesize one from the provided extension and URL. | 130 // synthesize one from the provided extension and URL. |
| 131 FilePath file_name(drop_data.file_description_filename); | 131 FilePath file_name(drop_data.file_description_filename); |
| 132 file_name = file_name.BaseName().RemoveExtension(); | 132 file_name = file_name.BaseName().RemoveExtension(); |
| 133 if (file_name.value().empty()) { | 133 if (file_name.value().empty()) { |
| 134 // Retrieve the name from the URL. | 134 // Retrieve the name from the URL. |
| 135 file_name = FilePath::FromWStringHack( | 135 file_name = FilePath::FromWStringHack( |
| 136 net::GetSuggestedFilename(drop_data.url, L"", L"")); | 136 net::GetSuggestedFilename(drop_data.url, "", "", L"")); |
| 137 } | 137 } |
| 138 file_name = file_name.ReplaceExtension(drop_data.file_extension); | 138 file_name = file_name.ReplaceExtension(drop_data.file_extension); |
| 139 data->SetFileContents(file_name.value(), drop_data.file_contents); | 139 data->SetFileContents(file_name.value(), drop_data.file_contents); |
| 140 } | 140 } |
| 141 if (!drop_data.text_html.empty()) | 141 if (!drop_data.text_html.empty()) |
| 142 data->SetHtml(drop_data.text_html, drop_data.html_base_url); | 142 data->SetHtml(drop_data.text_html, drop_data.html_base_url); |
| 143 if (drop_data.url.is_valid()) { | 143 if (drop_data.url.is_valid()) { |
| 144 if (drop_data.url.SchemeIs(chrome::kJavaScriptScheme)) { | 144 if (drop_data.url.SchemeIs(chrome::kJavaScriptScheme)) { |
| 145 // We don't want to allow javascript URLs to be dragged to the desktop, | 145 // We don't want to allow javascript URLs to be dragged to the desktop, |
| 146 // but we do want to allow them to be added to the bookmarks bar | 146 // but we do want to allow them to be added to the bookmarks bar |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 } | 607 } |
| 608 return false; | 608 return false; |
| 609 } | 609 } |
| 610 | 610 |
| 611 void TabContentsViewWin::WheelZoom(int distance) { | 611 void TabContentsViewWin::WheelZoom(int distance) { |
| 612 if (web_contents()->delegate()) { | 612 if (web_contents()->delegate()) { |
| 613 bool zoom_in = distance > 0; | 613 bool zoom_in = distance > 0; |
| 614 web_contents()->delegate()->ContentsZoomChange(zoom_in); | 614 web_contents()->delegate()->ContentsZoomChange(zoom_in); |
| 615 } | 615 } |
| 616 } | 616 } |
| OLD | NEW |