| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gtk_dnd_util.h" | 
| 6 | 6 | 
| 7 #include "base/logging.h" | 7 #include "base/logging.h" | 
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" | 
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" | 
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" | 
| 11 | 11 | 
| 12 static const int kBitsPerByte = 8; | 12 static const int kBitsPerByte = 8; | 
| 13 | 13 | 
|  | 14 using WebKit::WebDragOperationsMask; | 
|  | 15 using WebKit::WebDragOperation; | 
|  | 16 using WebKit::WebDragOperationNone; | 
|  | 17 using WebKit::WebDragOperationCopy; | 
|  | 18 using WebKit::WebDragOperationLink; | 
|  | 19 using WebKit::WebDragOperationMove; | 
|  | 20 | 
| 14 namespace { | 21 namespace { | 
| 15 | 22 | 
| 16 void AddTargetToList(GtkTargetList* targets, int target_code) { | 23 void AddTargetToList(GtkTargetList* targets, int target_code) { | 
| 17   switch (target_code) { | 24   switch (target_code) { | 
| 18     case gtk_dnd_util::TEXT_PLAIN: | 25     case gtk_dnd_util::TEXT_PLAIN: | 
| 19       gtk_target_list_add_text_targets(targets, gtk_dnd_util::TEXT_PLAIN); | 26       gtk_target_list_add_text_targets(targets, gtk_dnd_util::TEXT_PLAIN); | 
| 20       break; | 27       break; | 
| 21 | 28 | 
| 22     case gtk_dnd_util::TEXT_URI_LIST: | 29     case gtk_dnd_util::TEXT_URI_LIST: | 
| 23       gtk_target_list_add_uri_targets(targets, gtk_dnd_util::TEXT_URI_LIST); | 30       gtk_target_list_add_uri_targets(targets, gtk_dnd_util::TEXT_URI_LIST); | 
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 219   for (size_t i = 0; uris[i] != NULL; ++i) { | 226   for (size_t i = 0; uris[i] != NULL; ++i) { | 
| 220     GURL url(uris[i]); | 227     GURL url(uris[i]); | 
| 221     if (url.is_valid()) | 228     if (url.is_valid()) | 
| 222       urls->push_back(url); | 229       urls->push_back(url); | 
| 223   } | 230   } | 
| 224 | 231 | 
| 225   g_strfreev(uris); | 232   g_strfreev(uris); | 
| 226   return true; | 233   return true; | 
| 227 } | 234 } | 
| 228 | 235 | 
| 229 GdkDragAction WebDragOpToGdkDragAction(WebKit::WebDragOperationsMask op) { | 236 GdkDragAction WebDragOpToGdkDragAction(WebDragOperationsMask op) { | 
| 230   GdkDragAction action = static_cast<GdkDragAction>(0); | 237   GdkDragAction action = static_cast<GdkDragAction>(0); | 
| 231   if (op & WebKit::WebDragOperationCopy) | 238   if (op & WebDragOperationCopy) | 
| 232     action = static_cast<GdkDragAction>(action | GDK_ACTION_COPY); | 239     action = static_cast<GdkDragAction>(action | GDK_ACTION_COPY); | 
| 233   if (op & WebKit::WebDragOperationLink) | 240   if (op & WebDragOperationLink) | 
| 234     action = static_cast<GdkDragAction>(action | GDK_ACTION_LINK); | 241     action = static_cast<GdkDragAction>(action | GDK_ACTION_LINK); | 
| 235   if (op & WebKit::WebDragOperationMove) | 242   if (op & WebDragOperationMove) | 
| 236     action = static_cast<GdkDragAction>(action | GDK_ACTION_MOVE); | 243     action = static_cast<GdkDragAction>(action | GDK_ACTION_MOVE); | 
| 237   return action; | 244   return action; | 
| 238 } | 245 } | 
| 239 | 246 | 
|  | 247 WebDragOperationsMask GdkDragActionToWebDragOp(GdkDragAction action) { | 
|  | 248   WebDragOperationsMask op = WebDragOperationNone; | 
|  | 249   if (action & GDK_ACTION_COPY) | 
|  | 250     op = static_cast<WebDragOperationsMask>(op | WebDragOperationCopy); | 
|  | 251   if (action & GDK_ACTION_LINK) | 
|  | 252     op = static_cast<WebDragOperationsMask>(op | WebDragOperationLink); | 
|  | 253   if (action & GDK_ACTION_MOVE) | 
|  | 254     op = static_cast<WebDragOperationsMask>(op | WebDragOperationMove); | 
|  | 255   return op; | 
|  | 256 } | 
|  | 257 | 
| 240 }  // namespace gtk_dnd_util | 258 }  // namespace gtk_dnd_util | 
| OLD | NEW | 
|---|