Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: content/browser/web_contents/web_drag_dest_gtk.cc

Issue 120593003: Move kFileScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_drag_dest_gtk.h" 5 #include "content/browser/web_contents/web_drag_dest_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 gchar** uris = gtk_selection_data_get_uris(data); 194 gchar** uris = gtk_selection_data_get_uris(data);
195 if (uris) { 195 if (uris) {
196 drop_data_->url = GURL(); 196 drop_data_->url = GURL();
197 for (gchar** uri_iter = uris; *uri_iter; uri_iter++) { 197 for (gchar** uri_iter = uris; *uri_iter; uri_iter++) {
198 // Most file managers populate text/uri-list with file URLs when 198 // Most file managers populate text/uri-list with file URLs when
199 // dragging files. To avoid exposing file system paths to web content, 199 // dragging files. To avoid exposing file system paths to web content,
200 // file URLs are never set as the URL content for the drop. 200 // file URLs are never set as the URL content for the drop.
201 // TODO(estade): Can the filenames have a non-UTF8 encoding? 201 // TODO(estade): Can the filenames have a non-UTF8 encoding?
202 GURL url(*uri_iter); 202 GURL url(*uri_iter);
203 base::FilePath file_path; 203 base::FilePath file_path;
204 if (url.SchemeIs(chrome::kFileScheme) && 204 if (url.SchemeIs(kFileScheme) &&
205 net::FileURLToFilePath(url, &file_path)) { 205 net::FileURLToFilePath(url, &file_path)) {
206 drop_data_->filenames.push_back( 206 drop_data_->filenames.push_back(
207 DropData::FileInfo(base::UTF8ToUTF16(file_path.value()), 207 DropData::FileInfo(base::UTF8ToUTF16(file_path.value()),
208 base::string16())); 208 base::string16()));
209 // This is a hack. Some file managers also populate text/plain with 209 // This is a hack. Some file managers also populate text/plain with
210 // a file URL when dragging files, so we clear it to avoid exposing 210 // a file URL when dragging files, so we clear it to avoid exposing
211 // it to the web content. 211 // it to the web content.
212 drop_data_->text = base::NullableString16(); 212 drop_data_->text = base::NullableString16();
213 } else if (!drop_data_->url.is_valid()) { 213 } else if (!drop_data_->url.is_valid()) {
214 // Also set the first non-file URL as the URL content for the drop. 214 // Also set the first non-file URL as the URL content for the drop.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 gtk_drag_finish(context, is_drop_target_, FALSE, time); 332 gtk_drag_finish(context, is_drop_target_, FALSE, time);
333 333
334 return TRUE; 334 return TRUE;
335 } 335 }
336 336
337 RenderViewHostImpl* WebDragDestGtk::GetRenderViewHost() const { 337 RenderViewHostImpl* WebDragDestGtk::GetRenderViewHost() const {
338 return static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost()); 338 return static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost());
339 } 339 }
340 340
341 } // namespace content 341 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_unittest.cc ('k') | content/common/savable_url_schemes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698