| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/i18n/case_conversion.h" | 11 #include "base/i18n/case_conversion.h" |
| 12 #include "base/i18n/string_search.h" | 12 #include "base/i18n/string_search.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
| 15 #include "base/string16.h" | 15 #include "base/string16.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 18 #include "chrome/browser/bookmarks/bookmark_model.h" | 18 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 20 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 20 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 21 #include "chrome/browser/history/query_parser.h" | 21 #include "chrome/browser/history/query_parser.h" |
| 22 #include "chrome/browser/prefs/pref_registry_syncable.h" | |
| 23 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "components/user_prefs/pref_registry_syncable.h" |
| 25 #include "components/user_prefs/user_prefs.h" |
| 25 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
| 26 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
| 27 #include "ui/base/dragdrop/drag_drop_types.h" | 28 #include "ui/base/dragdrop/drag_drop_types.h" |
| 28 #include "ui/base/events/event.h" | 29 #include "ui/base/events/event.h" |
| 29 #include "ui/base/models/tree_node_iterator.h" | 30 #include "ui/base/models/tree_node_iterator.h" |
| 30 | 31 |
| 31 using base::Time; | 32 using base::Time; |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 | 35 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return ui::DragDropTypes::DRAG_COPY; | 127 return ui::DragDropTypes::DRAG_COPY; |
| 127 if (ui::DragDropTypes::DRAG_LINK & common_ops) | 128 if (ui::DragDropTypes::DRAG_LINK & common_ops) |
| 128 return ui::DragDropTypes::DRAG_LINK; | 129 return ui::DragDropTypes::DRAG_LINK; |
| 129 if (ui::DragDropTypes::DRAG_MOVE & common_ops) | 130 if (ui::DragDropTypes::DRAG_MOVE & common_ops) |
| 130 return ui::DragDropTypes::DRAG_MOVE; | 131 return ui::DragDropTypes::DRAG_MOVE; |
| 131 return ui::DragDropTypes::DRAG_NONE; | 132 return ui::DragDropTypes::DRAG_NONE; |
| 132 } | 133 } |
| 133 | 134 |
| 134 int BookmarkDragOperation(content::BrowserContext* browser_context, | 135 int BookmarkDragOperation(content::BrowserContext* browser_context, |
| 135 const BookmarkNode* node) { | 136 const BookmarkNode* node) { |
| 136 PrefService* prefs = PrefServiceFromBrowserContext(browser_context); | 137 PrefService* prefs = components::UserPrefs::Get(browser_context); |
| 137 | 138 |
| 138 int move = ui::DragDropTypes::DRAG_MOVE; | 139 int move = ui::DragDropTypes::DRAG_MOVE; |
| 139 if (!prefs->GetBoolean(prefs::kEditBookmarksEnabled)) | 140 if (!prefs->GetBoolean(prefs::kEditBookmarksEnabled)) |
| 140 move = 0; | 141 move = 0; |
| 141 if (node->is_url()) { | 142 if (node->is_url()) { |
| 142 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK | move; | 143 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK | move; |
| 143 } | 144 } |
| 144 return ui::DragDropTypes::DRAG_COPY | move; | 145 return ui::DragDropTypes::DRAG_COPY | move; |
| 145 } | 146 } |
| 146 | 147 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 void DisableBookmarkBarViewAnimationsForTesting(bool disabled) { | 521 void DisableBookmarkBarViewAnimationsForTesting(bool disabled) { |
| 521 g_bookmark_bar_view_animations_disabled = disabled; | 522 g_bookmark_bar_view_animations_disabled = disabled; |
| 522 } | 523 } |
| 523 | 524 |
| 524 bool IsBookmarkBarViewAnimationsDisabled() { | 525 bool IsBookmarkBarViewAnimationsDisabled() { |
| 525 return g_bookmark_bar_view_animations_disabled; | 526 return g_bookmark_bar_view_animations_disabled; |
| 526 } | 527 } |
| 527 #endif | 528 #endif |
| 528 | 529 |
| 529 } // namespace bookmark_utils | 530 } // namespace bookmark_utils |
| OLD | NEW |