OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/gtk/bookmark_bar_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/gtk_dnd_util.h" | 9 #include "app/gtk_dnd_util.h" |
10 #include "app/slide_animation.h" | 10 #include "app/slide_animation.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const double kSeparatorColor[] = | 79 const double kSeparatorColor[] = |
80 { 194.0 / 255.0, 205.0 / 255.0, 212.0 / 212.0 }; | 80 { 194.0 / 255.0, 205.0 / 255.0, 212.0 / 212.0 }; |
81 // Top color of the separator gradient. | 81 // Top color of the separator gradient. |
82 const double kTopBorderColor[] = | 82 const double kTopBorderColor[] = |
83 { 222.0 / 255.0, 234.0 / 255.0, 248.0 / 255.0 }; | 83 { 222.0 / 255.0, 234.0 / 255.0, 248.0 / 255.0 }; |
84 | 84 |
85 // The targets accepted by the toolbar and folder buttons for DnD. | 85 // The targets accepted by the toolbar and folder buttons for DnD. |
86 const int kDestTargetList[] = { gtk_dnd_util::CHROME_BOOKMARK_ITEM, | 86 const int kDestTargetList[] = { gtk_dnd_util::CHROME_BOOKMARK_ITEM, |
87 gtk_dnd_util::CHROME_NAMED_URL, | 87 gtk_dnd_util::CHROME_NAMED_URL, |
88 gtk_dnd_util::TEXT_URI_LIST, | 88 gtk_dnd_util::TEXT_URI_LIST, |
| 89 gtk_dnd_util::NETSCAPE_URL, |
89 gtk_dnd_util::TEXT_PLAIN, -1 }; | 90 gtk_dnd_util::TEXT_PLAIN, -1 }; |
90 | 91 |
91 // Acceptable drag actions for the bookmark bar drag destinations. | 92 // Acceptable drag actions for the bookmark bar drag destinations. |
92 const GdkDragAction kDragAction = | 93 const GdkDragAction kDragAction = |
93 GdkDragAction(GDK_ACTION_MOVE | GDK_ACTION_COPY); | 94 GdkDragAction(GDK_ACTION_MOVE | GDK_ACTION_COPY); |
94 | 95 |
95 void SetToolBarStyle() { | 96 void SetToolBarStyle() { |
96 static bool style_was_set = false; | 97 static bool style_was_set = false; |
97 | 98 |
98 if (style_was_set) | 99 if (style_was_set) |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 selection_data, model_, dest_node, index); | 1265 selection_data, model_, dest_node, index); |
1265 break; | 1266 break; |
1266 } | 1267 } |
1267 | 1268 |
1268 case gtk_dnd_util::TEXT_URI_LIST: { | 1269 case gtk_dnd_util::TEXT_URI_LIST: { |
1269 dnd_success = bookmark_utils::CreateNewBookmarksFromURIList( | 1270 dnd_success = bookmark_utils::CreateNewBookmarksFromURIList( |
1270 selection_data, model_, dest_node, index); | 1271 selection_data, model_, dest_node, index); |
1271 break; | 1272 break; |
1272 } | 1273 } |
1273 | 1274 |
| 1275 case gtk_dnd_util::NETSCAPE_URL: { |
| 1276 dnd_success = bookmark_utils::CreateNewBookmarkFromNetscapeURL( |
| 1277 selection_data, model_, dest_node, index); |
| 1278 break; |
| 1279 } |
| 1280 |
1274 case gtk_dnd_util::TEXT_PLAIN: { | 1281 case gtk_dnd_util::TEXT_PLAIN: { |
1275 guchar* text = gtk_selection_data_get_text(selection_data); | 1282 guchar* text = gtk_selection_data_get_text(selection_data); |
1276 if (!text) | 1283 if (!text) |
1277 break; | 1284 break; |
1278 GURL url(reinterpret_cast<char*>(text)); | 1285 GURL url(reinterpret_cast<char*>(text)); |
1279 g_free(text); | 1286 g_free(text); |
1280 // TODO(estade): It would be nice to head this case off at drag motion, | 1287 // TODO(estade): It would be nice to head this case off at drag motion, |
1281 // so that it doesn't look like we can drag onto the bookmark bar. | 1288 // so that it doesn't look like we can drag onto the bookmark bar. |
1282 if (!url.is_valid()) | 1289 if (!url.is_valid()) |
1283 break; | 1290 break; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 | 1416 |
1410 // Find the GtkWidget* for the actual target button. | 1417 // Find the GtkWidget* for the actual target button. |
1411 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1418 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
1412 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1419 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
1413 PopupForButton(folder_list[button_idx]); | 1420 PopupForButton(folder_list[button_idx]); |
1414 } | 1421 } |
1415 | 1422 |
1416 void BookmarkBarGtk::CloseMenu() { | 1423 void BookmarkBarGtk::CloseMenu() { |
1417 current_context_menu_->Cancel(); | 1424 current_context_menu_->Cancel(); |
1418 } | 1425 } |
OLD | NEW |