OLD | NEW |
1 // Copyright (c) 2010 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 #include "app/gtk_dnd_util.h" | 5 #include "ui/base/dragdrop/gtk_dnd_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 | 13 |
14 static const int kBitsPerByte = 8; | 14 static const int kBitsPerByte = 8; |
15 | 15 |
| 16 namespace ui { |
| 17 |
16 namespace { | 18 namespace { |
17 | 19 |
18 void AddTargetToList(GtkTargetList* targets, int target_code) { | 20 void AddTargetToList(GtkTargetList* targets, int target_code) { |
19 switch (target_code) { | 21 switch (target_code) { |
20 case gtk_dnd_util::TEXT_PLAIN: | 22 case gtk_dnd_util::TEXT_PLAIN: |
21 gtk_target_list_add_text_targets(targets, gtk_dnd_util::TEXT_PLAIN); | 23 gtk_target_list_add_text_targets(targets, gtk_dnd_util::TEXT_PLAIN); |
22 break; | 24 break; |
23 | 25 |
24 case gtk_dnd_util::TEXT_URI_LIST: | 26 case gtk_dnd_util::TEXT_URI_LIST: |
25 gtk_target_list_add_uri_targets(targets, gtk_dnd_util::TEXT_URI_LIST); | 27 gtk_target_list_add_uri_targets(targets, gtk_dnd_util::TEXT_URI_LIST); |
(...skipping 24 matching lines...) Expand all Loading... |
50 0, gtk_dnd_util::DIRECT_SAVE_FILE); | 52 0, gtk_dnd_util::DIRECT_SAVE_FILE); |
51 break; | 53 break; |
52 | 54 |
53 default: | 55 default: |
54 NOTREACHED() << " Unexpected target code: " << target_code; | 56 NOTREACHED() << " Unexpected target code: " << target_code; |
55 } | 57 } |
56 } | 58 } |
57 | 59 |
58 } // namespace | 60 } // namespace |
59 | 61 |
60 namespace gtk_dnd_util { | |
61 | |
62 GdkAtom GetAtomForTarget(int target) { | 62 GdkAtom GetAtomForTarget(int target) { |
63 switch (target) { | 63 switch (target) { |
64 case CHROME_TAB: | 64 case CHROME_TAB: |
65 static GdkAtom tab_atom = gdk_atom_intern( | 65 static GdkAtom tab_atom = gdk_atom_intern( |
66 const_cast<char*>("application/x-chrome-tab"), false); | 66 const_cast<char*>("application/x-chrome-tab"), false); |
67 return tab_atom; | 67 return tab_atom; |
68 | 68 |
69 case TEXT_HTML: | 69 case TEXT_HTML: |
70 static GdkAtom html_atom = gdk_atom_intern( | 70 static GdkAtom html_atom = gdk_atom_intern( |
71 const_cast<char*>("text/html"), false); | 71 const_cast<char*>("text/html"), false); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 GURL gurl(data.substr(0, newline)); | 254 GURL gurl(data.substr(0, newline)); |
255 if (!gurl.is_valid()) | 255 if (!gurl.is_valid()) |
256 return false; | 256 return false; |
257 | 257 |
258 *url = gurl; | 258 *url = gurl; |
259 *title = UTF8ToUTF16(data.substr(newline + 1)); | 259 *title = UTF8ToUTF16(data.substr(newline + 1)); |
260 return true; | 260 return true; |
261 } | 261 } |
262 | 262 |
263 } // namespace gtk_dnd_util | 263 } // namespace ui |
OLD | NEW |