Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: chrome/browser/bookmarks/bookmark_utils.cc

Issue 12340111: Introduce //components/user_prefs, use to eliminate c/b/prefs dependency in Autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge of LKGR Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 using content::UserMetricsAction; 33 using content::UserMetricsAction;
33 34
34 namespace { 35 namespace {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return ui::DragDropTypes::DRAG_COPY; 128 return ui::DragDropTypes::DRAG_COPY;
128 if (ui::DragDropTypes::DRAG_LINK & common_ops) 129 if (ui::DragDropTypes::DRAG_LINK & common_ops)
129 return ui::DragDropTypes::DRAG_LINK; 130 return ui::DragDropTypes::DRAG_LINK;
130 if (ui::DragDropTypes::DRAG_MOVE & common_ops) 131 if (ui::DragDropTypes::DRAG_MOVE & common_ops)
131 return ui::DragDropTypes::DRAG_MOVE; 132 return ui::DragDropTypes::DRAG_MOVE;
132 return ui::DragDropTypes::DRAG_NONE; 133 return ui::DragDropTypes::DRAG_NONE;
133 } 134 }
134 135
135 int BookmarkDragOperation(content::BrowserContext* browser_context, 136 int BookmarkDragOperation(content::BrowserContext* browser_context,
136 const BookmarkNode* node) { 137 const BookmarkNode* node) {
137 PrefService* prefs = PrefServiceFromBrowserContext(browser_context); 138 PrefService* prefs = components::UserPrefs::Get(browser_context);
138 139
139 int move = ui::DragDropTypes::DRAG_MOVE; 140 int move = ui::DragDropTypes::DRAG_MOVE;
140 if (!prefs->GetBoolean(prefs::kEditBookmarksEnabled)) 141 if (!prefs->GetBoolean(prefs::kEditBookmarksEnabled))
141 move = 0; 142 move = 0;
142 if (node->is_url()) { 143 if (node->is_url()) {
143 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK | move; 144 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK | move;
144 } 145 }
145 return ui::DragDropTypes::DRAG_COPY | move; 146 return ui::DragDropTypes::DRAG_COPY | move;
146 } 147 }
147 148
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 void DisableBookmarkBarViewAnimationsForTesting(bool disabled) { 525 void DisableBookmarkBarViewAnimationsForTesting(bool disabled) {
525 g_bookmark_bar_view_animations_disabled = disabled; 526 g_bookmark_bar_view_animations_disabled = disabled;
526 } 527 }
527 528
528 bool IsBookmarkBarViewAnimationsDisabled() { 529 bool IsBookmarkBarViewAnimationsDisabled() {
529 return g_bookmark_bar_view_animations_disabled; 530 return g_bookmark_bar_view_animations_disabled;
530 } 531 }
531 #endif 532 #endif
532 533
533 } // namespace bookmark_utils 534 } // namespace bookmark_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698