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/file_path.h" | 10 #include "base/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/string16.h" | 14 #include "base/string16.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "chrome/browser/bookmarks/bookmark_model.h" | 17 #include "chrome/browser/bookmarks/bookmark_model.h" |
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
19 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 19 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
20 #include "chrome/browser/history/query_parser.h" | 20 #include "chrome/browser/history/query_parser.h" |
21 #include "chrome/browser/prefs/pref_service_syncable.h" | 21 #include "chrome/browser/prefs/pref_registry_syncable.h" |
| 22 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
24 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
25 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
26 #include "ui/base/dragdrop/drag_drop_types.h" | 27 #include "ui/base/dragdrop/drag_drop_types.h" |
27 #include "ui/base/events/event.h" | 28 #include "ui/base/events/event.h" |
28 #include "ui/base/models/tree_node_iterator.h" | 29 #include "ui/base/models/tree_node_iterator.h" |
29 | 30 |
30 using base::Time; | 31 using base::Time; |
31 | 32 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 425 |
425 if (new_parent != node->parent()) | 426 if (new_parent != node->parent()) |
426 model->Move(node, new_parent, new_parent->child_count()); | 427 model->Move(node, new_parent, new_parent->child_count()); |
427 if (node->is_url()) | 428 if (node->is_url()) |
428 model->SetURL(node, new_url); | 429 model->SetURL(node, new_url); |
429 model->SetTitle(node, new_title); | 430 model->SetTitle(node, new_title); |
430 | 431 |
431 return node; | 432 return node; |
432 } | 433 } |
433 | 434 |
434 void RegisterUserPrefs(PrefServiceSyncable* prefs) { | 435 void RegisterUserPrefs(PrefRegistrySyncable* registry) { |
435 prefs->RegisterBooleanPref(prefs::kShowBookmarkBar, | 436 registry->RegisterBooleanPref(prefs::kShowBookmarkBar, |
436 false, | 437 false, |
437 PrefServiceSyncable::SYNCABLE_PREF); | 438 PrefRegistrySyncable::SYNCABLE_PREF); |
438 prefs->RegisterBooleanPref(prefs::kEditBookmarksEnabled, | 439 registry->RegisterBooleanPref(prefs::kEditBookmarksEnabled, |
439 true, | 440 true, |
440 PrefServiceSyncable::UNSYNCABLE_PREF); | 441 PrefRegistrySyncable::UNSYNCABLE_PREF); |
441 } | 442 } |
442 | 443 |
443 const BookmarkNode* GetParentForNewNodes( | 444 const BookmarkNode* GetParentForNewNodes( |
444 const BookmarkNode* parent, | 445 const BookmarkNode* parent, |
445 const std::vector<const BookmarkNode*>& selection, | 446 const std::vector<const BookmarkNode*>& selection, |
446 int* index) { | 447 int* index) { |
447 const BookmarkNode* real_parent = parent; | 448 const BookmarkNode* real_parent = parent; |
448 | 449 |
449 if (selection.size() == 1 && selection[0]->is_folder()) | 450 if (selection.size() == 1 && selection[0]->is_folder()) |
450 real_parent = selection[0]; | 451 real_parent = selection[0]; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 void DisableBookmarkBarViewAnimationsForTesting(bool disabled) { | 520 void DisableBookmarkBarViewAnimationsForTesting(bool disabled) { |
520 g_bookmark_bar_view_animations_disabled = disabled; | 521 g_bookmark_bar_view_animations_disabled = disabled; |
521 } | 522 } |
522 | 523 |
523 bool IsBookmarkBarViewAnimationsDisabled() { | 524 bool IsBookmarkBarViewAnimationsDisabled() { |
524 return g_bookmark_bar_view_animations_disabled; | 525 return g_bookmark_bar_view_animations_disabled; |
525 } | 526 } |
526 #endif | 527 #endif |
527 | 528 |
528 } // namespace bookmark_utils | 529 } // namespace bookmark_utils |
OLD | NEW |