| 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" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 147 // (bookmarklets). | 147 // (bookmarklets). So we create a fake bookmark entry (BookmarkDragData |
| 148 // object) which explorer.exe cannot handle, and write the entry to data. |
| 148 BookmarkDragData::Element bm_elt; | 149 BookmarkDragData::Element bm_elt; |
| 149 bm_elt.is_url = true; | 150 bm_elt.is_url = true; |
| 150 bm_elt.url = drop_data.url; | 151 bm_elt.url = drop_data.url; |
| 151 bm_elt.title = drop_data.url_title; | 152 bm_elt.title = drop_data.url_title; |
| 152 | 153 |
| 153 BookmarkDragData bm_drag_data; | 154 BookmarkDragData bm_drag_data; |
| 154 bm_drag_data.elements.push_back(bm_elt); | 155 bm_drag_data.elements.push_back(bm_elt); |
| 155 | 156 |
| 156 bm_drag_data.Write(tab_contents()->profile(), data); | 157 // Pass in NULL as the profile so that the bookmark always adds the url |
| 158 // rather than trying to move an existing url. |
| 159 bm_drag_data.Write(NULL, data); |
| 157 } else { | 160 } else { |
| 158 data->SetURL(drop_data.url, drop_data.url_title); | 161 data->SetURL(drop_data.url, drop_data.url_title); |
| 159 } | 162 } |
| 160 } | 163 } |
| 161 if (!drop_data.plain_text.empty()) | 164 if (!drop_data.plain_text.empty()) |
| 162 data->SetString(drop_data.plain_text); | 165 data->SetString(drop_data.plain_text); |
| 163 | 166 |
| 164 scoped_refptr<WebDragSource> drag_source( | 167 scoped_refptr<WebDragSource> drag_source( |
| 165 new WebDragSource(GetNativeView(), tab_contents()->render_view_host())); | 168 new WebDragSource(GetNativeView(), tab_contents()->render_view_host())); |
| 166 | 169 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 612 } |
| 610 return false; | 613 return false; |
| 611 } | 614 } |
| 612 | 615 |
| 613 void TabContentsViewWin::WheelZoom(int distance) { | 616 void TabContentsViewWin::WheelZoom(int distance) { |
| 614 if (tab_contents()->delegate()) { | 617 if (tab_contents()->delegate()) { |
| 615 bool zoom_in = distance > 0; | 618 bool zoom_in = distance > 0; |
| 616 tab_contents()->delegate()->ContentsZoomChange(zoom_in); | 619 tab_contents()->delegate()->ContentsZoomChange(zoom_in); |
| 617 } | 620 } |
| 618 } | 621 } |
| OLD | NEW |