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

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

Issue 2901463002: [MD Bookmarks] Add undo/redo functionality to MD Bookmarks. (Closed)
Patch Set: fix test Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/command_manager.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_model_factory.h" 5 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/deferred_sequenced_task_runner.h" 8 #include "base/deferred_sequenced_task_runner.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" 13 #include "chrome/browser/bookmarks/chrome_bookmark_client.h"
14 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" 14 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
15 #include "chrome/browser/bookmarks/startup_task_runner_service_factory.h" 15 #include "chrome/browser/bookmarks/startup_task_runner_service_factory.h"
16 #include "chrome/browser/profiles/incognito_helpers.h" 16 #include "chrome/browser/profiles/incognito_helpers.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.h"
18 #include "chrome/browser/undo/bookmark_undo_service_factory.h" 19 #include "chrome/browser/undo/bookmark_undo_service_factory.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "components/bookmarks/browser/bookmark_model.h" 21 #include "components/bookmarks/browser/bookmark_model.h"
21 #include "components/bookmarks/browser/bookmark_utils.h" 22 #include "components/bookmarks/browser/bookmark_utils.h"
22 #include "components/bookmarks/browser/startup_task_runner_service.h" 23 #include "components/bookmarks/browser/startup_task_runner_service.h"
23 #include "components/keyed_service/content/browser_context_dependency_manager.h" 24 #include "components/keyed_service/content/browser_context_dependency_manager.h"
24 #include "components/prefs/pref_service.h" 25 #include "components/prefs/pref_service.h"
25 #include "components/undo/bookmark_undo_service.h" 26 #include "components/undo/bookmark_undo_service.h"
26 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
27 28
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 profile, ManagedBookmarkServiceFactory::GetForProfile(profile))); 67 profile, ManagedBookmarkServiceFactory::GetForProfile(profile)));
67 bookmark_model->Load(profile->GetPrefs(), profile->GetPath(), 68 bookmark_model->Load(profile->GetPrefs(), profile->GetPath(),
68 StartupTaskRunnerServiceFactory::GetForProfile(profile) 69 StartupTaskRunnerServiceFactory::GetForProfile(profile)
69 ->GetBookmarkTaskRunner(), 70 ->GetBookmarkTaskRunner(),
70 content::BrowserThread::GetTaskRunnerForThread( 71 content::BrowserThread::GetTaskRunnerForThread(
71 content::BrowserThread::UI)); 72 content::BrowserThread::UI));
72 bool register_bookmark_undo_service_as_observer = true; 73 bool register_bookmark_undo_service_as_observer = true;
73 #if !defined(OS_ANDROID) 74 #if !defined(OS_ANDROID)
74 register_bookmark_undo_service_as_observer = 75 register_bookmark_undo_service_as_observer =
75 base::CommandLine::ForCurrentProcess()->HasSwitch( 76 base::CommandLine::ForCurrentProcess()->HasSwitch(
76 switches::kEnableBookmarkUndo); 77 switches::kEnableBookmarkUndo) ||
78 MdBookmarksUI::IsEnabled();
sky 2017/05/24 16:57:16 Where do we make use of the undo in non-android? F
calamity 2017/05/25 08:54:02 It's behind a flag for the bookmarks bar context m
sky 2017/05/25 18:09:06 If you don't enable undo in the menu how is it pos
77 #endif // !defined(OS_ANDROID) 79 #endif // !defined(OS_ANDROID)
78 if (register_bookmark_undo_service_as_observer) 80 if (register_bookmark_undo_service_as_observer)
79 BookmarkUndoServiceFactory::GetForProfile(profile)->Start(bookmark_model); 81 BookmarkUndoServiceFactory::GetForProfile(profile)->Start(bookmark_model);
80 82
81 return bookmark_model; 83 return bookmark_model;
82 } 84 }
83 85
84 void BookmarkModelFactory::RegisterProfilePrefs( 86 void BookmarkModelFactory::RegisterProfilePrefs(
85 user_prefs::PrefRegistrySyncable* registry) { 87 user_prefs::PrefRegistrySyncable* registry) {
86 bookmarks::RegisterProfilePrefs(registry); 88 bookmarks::RegisterProfilePrefs(registry);
87 } 89 }
88 90
89 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( 91 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse(
90 content::BrowserContext* context) const { 92 content::BrowserContext* context) const {
91 return chrome::GetBrowserContextRedirectedInIncognito(context); 93 return chrome::GetBrowserContextRedirectedInIncognito(context);
92 } 94 }
93 95
94 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { 96 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const {
95 return true; 97 return true;
96 } 98 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/command_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698