| 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/bookmarks/bookmark_utils.h" | 5 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 6 | 6 |
| 7 #include "app/clipboard/clipboard.h" | 7 #include "app/clipboard/clipboard.h" |
| 8 #include "app/drag_drop_types.h" | 8 #include "app/drag_drop_types.h" |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/tree_node_iterator.h" | 10 #include "app/tree_node_iterator.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "grit/chromium_strings.h" | 33 #include "grit/chromium_strings.h" |
| 34 #include "grit/generated_resources.h" | 34 #include "grit/generated_resources.h" |
| 35 #include "net/base/net_util.h" | 35 #include "net/base/net_util.h" |
| 36 #include "views/event.h" | 36 #include "views/event.h" |
| 37 | 37 |
| 38 #if defined(TOOLKIT_VIEWS) | 38 #if defined(TOOLKIT_VIEWS) |
| 39 #include "app/os_exchange_data.h" | 39 #include "app/os_exchange_data.h" |
| 40 #include "views/drag_utils.h" | 40 #include "views/drag_utils.h" |
| 41 #include "views/widget/root_view.h" | 41 #include "views/widget/root_view.h" |
| 42 #include "views/widget/widget.h" | 42 #include "views/widget/widget.h" |
| 43 #elif defined(TOOLKIT_GTK) |
| 44 #include "chrome/browser/gtk/custom_drag.h" |
| 43 #endif | 45 #endif |
| 44 | 46 |
| 45 using base::Time; | 47 using base::Time; |
| 46 | 48 |
| 47 namespace { | 49 namespace { |
| 48 | 50 |
| 49 // A PageNavigator implementation that creates a new Browser. This is used when | 51 // A PageNavigator implementation that creates a new Browser. This is used when |
| 50 // opening a url and there is no Browser open. The Browser is created the first | 52 // opening a url and there is no Browser open. The Browser is created the first |
| 51 // time the PageNavigator method is invoked. | 53 // time the PageNavigator method is invoked. |
| 52 class NewBrowserPageNavigator : public PageNavigator { | 54 class NewBrowserPageNavigator : public PageNavigator { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_MOVE | | 347 DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_MOVE | |
| 346 DragDropTypes::DRAG_LINK); | 348 DragDropTypes::DRAG_LINK); |
| 347 | 349 |
| 348 MessageLoop::current()->SetNestableTasksAllowed(was_nested); | 350 MessageLoop::current()->SetNestableTasksAllowed(was_nested); |
| 349 #elif defined(OS_MACOSX) | 351 #elif defined(OS_MACOSX) |
| 350 // Allow nested message loop so we get DnD events as we drag this around. | 352 // Allow nested message loop so we get DnD events as we drag this around. |
| 351 bool was_nested = MessageLoop::current()->IsNested(); | 353 bool was_nested = MessageLoop::current()->IsNested(); |
| 352 MessageLoop::current()->SetNestableTasksAllowed(true); | 354 MessageLoop::current()->SetNestableTasksAllowed(true); |
| 353 bookmark_pasteboard_helper_mac::StartDrag(profile, nodes, view); | 355 bookmark_pasteboard_helper_mac::StartDrag(profile, nodes, view); |
| 354 MessageLoop::current()->SetNestableTasksAllowed(was_nested); | 356 MessageLoop::current()->SetNestableTasksAllowed(was_nested); |
| 355 #else | 357 #elif defined(TOOLKIT_GTK) |
| 356 // TODO(arv): Implement for GTK. | 358 BookmarkDrag::BeginDrag(profile, nodes); |
| 357 NOTIMPLEMENTED(); | |
| 358 #endif | 359 #endif |
| 359 } | 360 } |
| 360 | 361 |
| 361 void OpenAll(gfx::NativeWindow parent, | 362 void OpenAll(gfx::NativeWindow parent, |
| 362 Profile* profile, | 363 Profile* profile, |
| 363 PageNavigator* navigator, | 364 PageNavigator* navigator, |
| 364 const std::vector<const BookmarkNode*>& nodes, | 365 const std::vector<const BookmarkNode*>& nodes, |
| 365 WindowOpenDisposition initial_disposition) { | 366 WindowOpenDisposition initial_disposition) { |
| 366 if (!ShouldOpenAll(parent, nodes)) | 367 if (!ShouldOpenAll(parent, nodes)) |
| 367 return; | 368 return; |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 std::vector<std::pair<GURL, std::wstring> >* urls) { | 649 std::vector<std::pair<GURL, std::wstring> >* urls) { |
| 649 for (int i = 0; i < browser->tab_count(); ++i) { | 650 for (int i = 0; i < browser->tab_count(); ++i) { |
| 650 std::pair<GURL, std::wstring> entry; | 651 std::pair<GURL, std::wstring> entry; |
| 651 GetURLAndTitleToBookmark(browser->GetTabContentsAt(i), &(entry.first), | 652 GetURLAndTitleToBookmark(browser->GetTabContentsAt(i), &(entry.first), |
| 652 &(entry.second)); | 653 &(entry.second)); |
| 653 urls->push_back(entry); | 654 urls->push_back(entry); |
| 654 } | 655 } |
| 655 } | 656 } |
| 656 | 657 |
| 657 } // namespace bookmark_utils | 658 } // namespace bookmark_utils |
| OLD | NEW |