OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/ntp/bookmarks_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/bookmarks_handler.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_extension_api_constants.h" |
12 #include "chrome/browser/bookmarks/bookmark_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_model.h" |
13 #include "chrome/browser/extensions/extension_bookmarks_module_constants.h" | |
14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/sync/profile_sync_service.h" | 16 #include "chrome/browser/sync/profile_sync_service.h" |
17 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 17 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
18 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 | 20 |
21 // TODO(csilv): | 21 // TODO(csilv): |
22 // Much of this implementation is based on the classes defined in | 22 // Much of this implementation is based on the classes defined in |
23 // extension_bookmarks_module.cc. Longer term we should consider migrating | 23 // extension_bookmarks_module.cc. Longer term we should consider migrating |
24 // NTP into an embedded extension which would allow us to leverage the same | 24 // NTP into an embedded extension which would allow us to leverage the same |
25 // bookmark APIs as the bookmark manager. | 25 // bookmark APIs as the bookmark manager. |
26 | 26 |
27 namespace keys = extension_bookmarks_module_constants; | 27 namespace keys = bookmark_extension_api_constants; |
28 | 28 |
29 BookmarksHandler::BookmarksHandler() : model_(NULL), | 29 BookmarksHandler::BookmarksHandler() : model_(NULL), |
30 dom_ready_(false), | 30 dom_ready_(false), |
31 from_current_page_(false) { | 31 from_current_page_(false) { |
32 } | 32 } |
33 | 33 |
34 BookmarksHandler::~BookmarksHandler() { | 34 BookmarksHandler::~BookmarksHandler() { |
35 if (model_) | 35 if (model_) |
36 model_->RemoveObserver(this); | 36 model_->RemoveObserver(this); |
37 } | 37 } |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 // static | 332 // static |
333 void BookmarksHandler::RegisterUserPrefs(PrefService* prefs) { | 333 void BookmarksHandler::RegisterUserPrefs(PrefService* prefs) { |
334 // Default folder is the root node. | 334 // Default folder is the root node. |
335 // TODO(csilv): Should we sync this preference? | 335 // TODO(csilv): Should we sync this preference? |
336 prefs->RegisterInt64Pref(prefs::kNTPShownBookmarksFolder, 0, | 336 prefs->RegisterInt64Pref(prefs::kNTPShownBookmarksFolder, 0, |
337 PrefService::UNSYNCABLE_PREF); | 337 PrefService::UNSYNCABLE_PREF); |
338 } | 338 } |
OLD | NEW |