| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 NotificationRegistrar registrar_; | 149 NotificationRegistrar registrar_; |
| 150 | 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(WebDragSourceAura); | 151 DISALLOW_COPY_AND_ASSIGN(WebDragSourceAura); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 #if (!defined(OS_CHROMEOS) && defined(USE_X11)) || defined(OS_WIN) | 154 #if (!defined(OS_CHROMEOS) && defined(USE_X11)) || defined(OS_WIN) |
| 155 // Fill out the OSExchangeData with a file contents, synthesizing a name if | 155 // Fill out the OSExchangeData with a file contents, synthesizing a name if |
| 156 // necessary. | 156 // necessary. |
| 157 void PrepareDragForFileContents(const DropData& drop_data, | 157 void PrepareDragForFileContents(const DropData& drop_data, |
| 158 ui::OSExchangeData::Provider* provider) { | 158 ui::OSExchangeData::Provider* provider) { |
| 159 base::FilePath file_name = | 159 base::Optional<base::FilePath> filename = |
| 160 base::FilePath::FromUTF16Unsafe(drop_data.file_description_filename); | 160 drop_data.GetSafeFilenameForImageFileContents(); |
| 161 // Images without ALT text will only have a file extension so we need to | 161 if (filename) |
| 162 // synthesize one from the provided extension and URL. | 162 provider->SetFileContents(*filename, drop_data.file_contents); |
| 163 if (file_name.BaseName().RemoveExtension().empty()) { | |
| 164 const base::FilePath::StringType extension = file_name.Extension(); | |
| 165 // Retrieve the name from the URL. | |
| 166 file_name = net::GenerateFileName(drop_data.url, "", "", "", "", "") | |
| 167 .ReplaceExtension(extension); | |
| 168 } | |
| 169 provider->SetFileContents(file_name, drop_data.file_contents); | |
| 170 } | 163 } |
| 171 #endif | 164 #endif |
| 172 | 165 |
| 173 #if defined(OS_WIN) | 166 #if defined(OS_WIN) |
| 174 void PrepareDragForDownload( | 167 void PrepareDragForDownload( |
| 175 const DropData& drop_data, | 168 const DropData& drop_data, |
| 176 ui::OSExchangeData::Provider* provider, | 169 ui::OSExchangeData::Provider* provider, |
| 177 WebContentsImpl* web_contents) { | 170 WebContentsImpl* web_contents) { |
| 178 const GURL& page_url = web_contents->GetLastCommittedURL(); | 171 const GURL& page_url = web_contents->GetLastCommittedURL(); |
| 179 const std::string& page_encoding = web_contents->GetEncoding(); | 172 const std::string& page_encoding = web_contents->GetEncoding(); |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 bool allow_multiple_selection) { | 1324 bool allow_multiple_selection) { |
| 1332 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; | 1325 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; |
| 1333 } | 1326 } |
| 1334 | 1327 |
| 1335 void WebContentsViewAura::HidePopupMenu() { | 1328 void WebContentsViewAura::HidePopupMenu() { |
| 1336 NOTIMPLEMENTED(); | 1329 NOTIMPLEMENTED(); |
| 1337 } | 1330 } |
| 1338 #endif | 1331 #endif |
| 1339 | 1332 |
| 1340 } // namespace content | 1333 } // namespace content |
| OLD | NEW |