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

Side by Side Diff: chrome/browser/ui/cocoa/drag_util.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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/cocoa/drag_util.h" 5 #import "chrome/browser/ui/cocoa/drag_util.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "content/public/browser/plugin_service.h" 9 #include "content/public/browser/plugin_service.h"
10 #include "content/public/common/url_constants.h"
11 #include "content/public/common/webplugininfo.h" 10 #include "content/public/common/webplugininfo.h"
12 #include "ipc/ipc_message.h" 11 #include "ipc/ipc_message.h"
13 #include "net/base/filename_util.h" 12 #include "net/base/filename_util.h"
14 #include "net/base/mime_util.h" 13 #include "net/base/mime_util.h"
15 #import "third_party/mozilla/NSPasteboard+Utils.h" 14 #import "third_party/mozilla/NSPasteboard+Utils.h"
16 #import "ui/base/dragdrop/cocoa_dnd_util.h" 15 #import "ui/base/dragdrop/cocoa_dnd_util.h"
17 #include "url/gurl.h" 16 #include "url/gurl.h"
17 #include "url/url_constants.h"
18 18
19 using content::PluginService; 19 using content::PluginService;
20 20
21 namespace drag_util { 21 namespace drag_util {
22 22
23 namespace { 23 namespace {
24 24
25 BOOL IsSupportedFileURL(Profile* profile, const GURL& url) { 25 BOOL IsSupportedFileURL(Profile* profile, const GURL& url) {
26 base::FilePath full_path; 26 base::FilePath full_path;
27 net::FileURLToFilePath(url, &full_path); 27 net::FileURLToFilePath(url, &full_path);
(...skipping 23 matching lines...) Expand all
51 } // namespace 51 } // namespace
52 52
53 GURL GetFileURLFromDropData(id<NSDraggingInfo> info) { 53 GURL GetFileURLFromDropData(id<NSDraggingInfo> info) {
54 if ([[info draggingPasteboard] containsURLData]) { 54 if ([[info draggingPasteboard] containsURLData]) {
55 GURL url; 55 GURL url;
56 ui::PopulateURLAndTitleFromPasteboard(&url, 56 ui::PopulateURLAndTitleFromPasteboard(&url,
57 NULL, 57 NULL,
58 [info draggingPasteboard], 58 [info draggingPasteboard],
59 YES); 59 YES);
60 60
61 if (url.SchemeIs(content::kFileScheme)) 61 if (url.SchemeIs(url::kFileScheme))
62 return url; 62 return url;
63 } 63 }
64 return GURL(); 64 return GURL();
65 } 65 }
66 66
67 BOOL IsUnsupportedDropData(Profile* profile, id<NSDraggingInfo> info) { 67 BOOL IsUnsupportedDropData(Profile* profile, id<NSDraggingInfo> info) {
68 GURL url = GetFileURLFromDropData(info); 68 GURL url = GetFileURLFromDropData(info);
69 if (!url.is_empty()) { 69 if (!url.is_empty()) {
70 // If dragging a file, only allow dropping supported file types (that the 70 // If dragging a file, only allow dropping supported file types (that the
71 // web view can display). 71 // web view can display).
72 return !IsSupportedFileURL(profile, url); 72 return !IsSupportedFileURL(profile, url);
73 } 73 }
74 return NO; 74 return NO;
75 } 75 }
76 76
77 } // namespace drag_util 77 } // namespace drag_util
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698