Index: chrome/browser/bookmarks/bookmark_model_factory.cc |
diff --git a/chrome/browser/bookmarks/bookmark_model_factory.cc b/chrome/browser/bookmarks/bookmark_model_factory.cc |
index 46069a63f171a5c6647cf839d8682b6dfe99ae56..e6d62d6a97b6c60de8dc7999b2f2e44fec14b28f 100644 |
--- a/chrome/browser/bookmarks/bookmark_model_factory.cc |
+++ b/chrome/browser/bookmarks/bookmark_model_factory.cc |
@@ -15,6 +15,7 @@ |
#include "chrome/browser/bookmarks/startup_task_runner_service_factory.h" |
#include "chrome/browser/profiles/incognito_helpers.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.h" |
#include "chrome/browser/undo/bookmark_undo_service_factory.h" |
#include "chrome/common/chrome_switches.h" |
#include "components/bookmarks/browser/bookmark_model.h" |
@@ -27,6 +28,21 @@ |
using bookmarks::BookmarkModel; |
+namespace { |
+ |
+bool IsBookmarkUndoServiceEnabled() { |
+ bool register_bookmark_undo_service_as_observer = true; |
+#if !defined(OS_ANDROID) |
+ register_bookmark_undo_service_as_observer = |
+ base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableBookmarkUndo) || |
+ MdBookmarksUI::IsEnabled(); |
+#endif // !defined(OS_ANDROID) |
+ return register_bookmark_undo_service_as_observer; |
+} |
+ |
+} // namespace |
+ |
// static |
BookmarkModel* BookmarkModelFactory::GetForBrowserContext( |
content::BrowserContext* context) { |
@@ -69,13 +85,7 @@ KeyedService* BookmarkModelFactory::BuildServiceInstanceFor( |
->GetBookmarkTaskRunner(), |
content::BrowserThread::GetTaskRunnerForThread( |
content::BrowserThread::UI)); |
- bool register_bookmark_undo_service_as_observer = true; |
-#if !defined(OS_ANDROID) |
- register_bookmark_undo_service_as_observer = |
- base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnableBookmarkUndo); |
-#endif // !defined(OS_ANDROID) |
- if (register_bookmark_undo_service_as_observer) |
+ if (IsBookmarkUndoServiceEnabled()) |
BookmarkUndoServiceFactory::GetForProfile(profile)->Start(bookmark_model); |
return bookmark_model; |