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

Side by Side Diff: content/browser/web_contents/web_drag_source_mac.mm

Issue 273193004: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. Created 6 years, 6 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
« no previous file with comments | « content/browser/storage_partition_impl_map.cc ('k') | content/common/savable_url_schemes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "content/browser/web_contents/web_drag_source_mac.h" 5 #import "content/browser/web_contents/web_drag_source_mac.h"
6 6
7 #include <sys/param.h> 7 #include <sys/param.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/mac/mac_util.h" 12 #include "base/mac/mac_util.h"
13 #include "base/pickle.h" 13 #include "base/pickle.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
19 #include "content/browser/browser_thread_impl.h" 19 #include "content/browser/browser_thread_impl.h"
20 #include "content/browser/download/drag_download_file.h" 20 #include "content/browser/download/drag_download_file.h"
21 #include "content/browser/download/drag_download_util.h" 21 #include "content/browser/download/drag_download_util.h"
22 #include "content/browser/renderer_host/render_view_host_impl.h" 22 #include "content/browser/renderer_host/render_view_host_impl.h"
23 #include "content/browser/web_contents/web_contents_impl.h" 23 #include "content/browser/web_contents/web_contents_impl.h"
24 #include "content/public/browser/content_browser_client.h" 24 #include "content/public/browser/content_browser_client.h"
25 #include "content/public/common/content_client.h" 25 #include "content/public/common/content_client.h"
26 #include "content/public/common/drop_data.h" 26 #include "content/public/common/drop_data.h"
27 #include "content/public/common/url_constants.h"
28 #include "grit/ui_resources.h" 27 #include "grit/ui_resources.h"
29 #include "net/base/escape.h" 28 #include "net/base/escape.h"
30 #include "net/base/filename_util.h" 29 #include "net/base/filename_util.h"
31 #include "net/base/mime_util.h" 30 #include "net/base/mime_util.h"
32 #include "ui/base/clipboard/custom_data_helper.h" 31 #include "ui/base/clipboard/custom_data_helper.h"
33 #include "ui/base/dragdrop/cocoa_dnd_util.h" 32 #include "ui/base/dragdrop/cocoa_dnd_util.h"
34 #include "ui/gfx/image/image.h" 33 #include "ui/gfx/image/image.h"
34 #include "url/url_constants.h"
35 35
36 using base::SysNSStringToUTF8; 36 using base::SysNSStringToUTF8;
37 using base::SysUTF8ToNSString; 37 using base::SysUTF8ToNSString;
38 using base::SysUTF16ToNSString; 38 using base::SysUTF16ToNSString;
39 using content::BrowserThread; 39 using content::BrowserThread;
40 using content::DragDownloadFile; 40 using content::DragDownloadFile;
41 using content::DropData; 41 using content::DropData;
42 using content::PromiseFileFinalizer; 42 using content::PromiseFileFinalizer;
43 using content::RenderViewHostImpl; 43 using content::RenderViewHostImpl;
44 44
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // See comment on |kHtmlHeader| above. 162 // See comment on |kHtmlHeader| above.
163 [pboard setString:SysUTF16ToNSString(kHtmlHeader + dropData_->html.string()) 163 [pboard setString:SysUTF16ToNSString(kHtmlHeader + dropData_->html.string())
164 forType:type]; 164 forType:type];
165 165
166 // URL. 166 // URL.
167 } else if ([type isEqualToString:NSURLPboardType]) { 167 } else if ([type isEqualToString:NSURLPboardType]) {
168 DCHECK(dropData_->url.is_valid()); 168 DCHECK(dropData_->url.is_valid());
169 NSURL* url = [NSURL URLWithString:SysUTF8ToNSString(dropData_->url.spec())]; 169 NSURL* url = [NSURL URLWithString:SysUTF8ToNSString(dropData_->url.spec())];
170 // If NSURL creation failed, check for a badly-escaped JavaScript URL. 170 // If NSURL creation failed, check for a badly-escaped JavaScript URL.
171 // Strip out any existing escapes and then re-escape uniformly. 171 // Strip out any existing escapes and then re-escape uniformly.
172 if (!url && dropData_->url.SchemeIs(content::kJavaScriptScheme)) { 172 if (!url && dropData_->url.SchemeIs(url::kJavaScriptScheme)) {
173 net::UnescapeRule::Type unescapeRules = 173 net::UnescapeRule::Type unescapeRules =
174 net::UnescapeRule::SPACES | 174 net::UnescapeRule::SPACES |
175 net::UnescapeRule::URL_SPECIAL_CHARS | 175 net::UnescapeRule::URL_SPECIAL_CHARS |
176 net::UnescapeRule::CONTROL_CHARS; 176 net::UnescapeRule::CONTROL_CHARS;
177 std::string unescapedUrlString = 177 std::string unescapedUrlString =
178 net::UnescapeURLComponent(dropData_->url.spec(), unescapeRules); 178 net::UnescapeURLComponent(dropData_->url.spec(), unescapeRules);
179 std::string escapedUrlString = 179 std::string escapedUrlString =
180 net::EscapeUrlEncodedData(unescapedUrlString, false); 180 net::EscapeUrlEncodedData(unescapedUrlString, false);
181 url = [NSURL URLWithString:SysUTF8ToNSString(escapedUrlString)]; 181 url = [NSURL URLWithString:SysUTF8ToNSString(escapedUrlString)];
182 } 182 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 - (NSImage*)dragImage { 457 - (NSImage*)dragImage {
458 if (dragImage_) 458 if (dragImage_)
459 return dragImage_; 459 return dragImage_;
460 460
461 // Default to returning a generic image. 461 // Default to returning a generic image.
462 return content::GetContentClient()->GetNativeImageNamed( 462 return content::GetContentClient()->GetNativeImageNamed(
463 IDR_DEFAULT_FAVICON).ToNSImage(); 463 IDR_DEFAULT_FAVICON).ToNSImage();
464 } 464 }
465 465
466 @end // @implementation WebDragSource (Private) 466 @end // @implementation WebDragSource (Private)
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl_map.cc ('k') | content/common/savable_url_schemes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698