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/views/tab_contents/tab_contents_view_win.h" | 5 #include "chrome/browser/views/tab_contents/tab_contents_view_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "app/gfx/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
10 #include "app/os_exchange_data.h" | 10 #include "app/os_exchange_data.h" |
11 #include "app/os_exchange_data_provider_win.h" | 11 #include "app/os_exchange_data_provider_win.h" |
| 12 #include "base/file_path.h" |
12 #include "base/keyboard_codes.h" | 13 #include "base/keyboard_codes.h" |
13 #include "base/time.h" | 14 #include "base/time.h" |
14 #include "base/win_util.h" | 15 #include "base/win_util.h" |
15 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 16 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
16 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. | 17 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. |
17 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/download/download_request_manager.h" | 19 #include "chrome/browser/download/download_request_manager.h" |
19 #include "chrome/browser/renderer_host/render_process_host.h" | 20 #include "chrome/browser/renderer_host/render_process_host.h" |
20 #include "chrome/browser/renderer_host/render_view_host.h" | 21 #include "chrome/browser/renderer_host/render_view_host.h" |
21 #include "chrome/browser/renderer_host/render_view_host_factory.h" | 22 #include "chrome/browser/renderer_host/render_view_host_factory.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // We set the file contents before the URL because the URL also sets file | 132 // We set the file contents before the URL because the URL also sets file |
132 // contents (to a .URL shortcut). We want to prefer file content data over a | 133 // contents (to a .URL shortcut). We want to prefer file content data over a |
133 // shortcut so we add it first. | 134 // shortcut so we add it first. |
134 if (!drop_data.file_contents.empty()) { | 135 if (!drop_data.file_contents.empty()) { |
135 // Images without ALT text will only have a file extension so we need to | 136 // Images without ALT text will only have a file extension so we need to |
136 // synthesize one from the provided extension and URL. | 137 // synthesize one from the provided extension and URL. |
137 FilePath file_name(drop_data.file_description_filename); | 138 FilePath file_name(drop_data.file_description_filename); |
138 file_name = file_name.BaseName().RemoveExtension(); | 139 file_name = file_name.BaseName().RemoveExtension(); |
139 if (file_name.value().empty()) { | 140 if (file_name.value().empty()) { |
140 // Retrieve the name from the URL. | 141 // Retrieve the name from the URL. |
141 file_name = net::GetSuggestedFilename(drop_data.url, "", "", ""); | 142 file_name = net::GetSuggestedFilename(drop_data.url, "", "", FilePath()); |
142 if (file_name.value().size() + drop_data.file_extension.size() + 1 > | 143 if (file_name.value().size() + drop_data.file_extension.size() + 1 > |
143 MAX_PATH) { | 144 MAX_PATH) { |
144 file_name = FilePath(file_name.value().substr( | 145 file_name = FilePath(file_name.value().substr( |
145 0, MAX_PATH - drop_data.file_extension.size() - 2)); | 146 0, MAX_PATH - drop_data.file_extension.size() - 2)); |
146 } | 147 } |
147 } | 148 } |
148 file_name = file_name.ReplaceExtension(drop_data.file_extension); | 149 file_name = file_name.ReplaceExtension(drop_data.file_extension); |
149 data.SetFileContents(file_name.value(), drop_data.file_contents); | 150 data.SetFileContents(file_name.value(), drop_data.file_contents); |
150 } | 151 } |
151 if (!drop_data.text_html.empty()) | 152 if (!drop_data.text_html.empty()) |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 } | 654 } |
654 return false; | 655 return false; |
655 } | 656 } |
656 | 657 |
657 void TabContentsViewWin::WheelZoom(int distance) { | 658 void TabContentsViewWin::WheelZoom(int distance) { |
658 if (tab_contents()->delegate()) { | 659 if (tab_contents()->delegate()) { |
659 bool zoom_in = distance > 0; | 660 bool zoom_in = distance > 0; |
660 tab_contents()->delegate()->ContentsZoomChange(zoom_in); | 661 tab_contents()->delegate()->ContentsZoomChange(zoom_in); |
661 } | 662 } |
662 } | 663 } |
OLD | NEW |