OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_bookmark_client.h" | 5 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/debug/leak_annotations.h" |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/values.h" | 11 #include "base/values.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/favicon/favicon_changed_details.h" | 13 #include "chrome/browser/favicon/favicon_changed_details.h" |
13 #include "chrome/browser/favicon/favicon_service.h" | 14 #include "chrome/browser/favicon/favicon_service.h" |
14 #include "chrome/browser/favicon/favicon_service_factory.h" | 15 #include "chrome/browser/favicon/favicon_service_factory.h" |
15 #include "chrome/browser/history/history_service.h" | 16 #include "chrome/browser/history/history_service.h" |
16 #include "chrome/browser/history/history_service_factory.h" | 17 #include "chrome/browser/history/history_service_factory.h" |
17 #include "chrome/browser/policy/profile_policy_connector.h" | 18 #include "chrome/browser/policy/profile_policy_connector.h" |
18 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 19 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 159 } |
159 | 160 |
160 void ChromeBookmarkClient::RecordAction(const base::UserMetricsAction& action) { | 161 void ChromeBookmarkClient::RecordAction(const base::UserMetricsAction& action) { |
161 content::RecordAction(action); | 162 content::RecordAction(action); |
162 } | 163 } |
163 | 164 |
164 bookmarks::LoadExtraCallback ChromeBookmarkClient::GetLoadExtraNodesCallback() { | 165 bookmarks::LoadExtraCallback ChromeBookmarkClient::GetLoadExtraNodesCallback() { |
165 // Create the managed_node now; it will be populated in the LoadExtraNodes | 166 // Create the managed_node now; it will be populated in the LoadExtraNodes |
166 // callback. | 167 // callback. |
167 managed_node_ = new BookmarkPermanentNode(0); | 168 managed_node_ = new BookmarkPermanentNode(0); |
| 169 // The ownership of this object is in limbo until the LoadExtraNodes task |
| 170 // runs, but in a ProfileBrowserTest this never happens. |
| 171 // crbug.com/391508 |
| 172 ANNOTATE_LEAKING_OBJECT_PTR(managed_node_); |
| 173 |
168 return base::Bind( | 174 return base::Bind( |
169 &ChromeBookmarkClient::LoadExtraNodes, | 175 &ChromeBookmarkClient::LoadExtraNodes, |
170 StartupTaskRunnerServiceFactory::GetForProfile(profile_) | 176 StartupTaskRunnerServiceFactory::GetForProfile(profile_) |
171 ->GetBookmarkTaskRunner(), | 177 ->GetBookmarkTaskRunner(), |
172 managed_node_, | 178 managed_node_, |
173 base::Passed(managed_bookmarks_tracker_->GetInitialManagedBookmarks())); | 179 base::Passed(managed_bookmarks_tracker_->GetInitialManagedBookmarks())); |
174 } | 180 } |
175 | 181 |
176 bool ChromeBookmarkClient::CanSetPermanentNodeTitle( | 182 bool ChromeBookmarkClient::CanSetPermanentNodeTitle( |
177 const BookmarkNode* permanent_node) { | 183 const BookmarkNode* permanent_node) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 return extra_nodes.Pass(); | 260 return extra_nodes.Pass(); |
255 } | 261 } |
256 | 262 |
257 std::string ChromeBookmarkClient::GetManagedBookmarksDomain() { | 263 std::string ChromeBookmarkClient::GetManagedBookmarksDomain() { |
258 policy::ProfilePolicyConnector* connector = | 264 policy::ProfilePolicyConnector* connector = |
259 policy::ProfilePolicyConnectorFactory::GetForProfile(profile_); | 265 policy::ProfilePolicyConnectorFactory::GetForProfile(profile_); |
260 if (connector->IsPolicyFromCloudPolicy(policy::key::kManagedBookmarks)) | 266 if (connector->IsPolicyFromCloudPolicy(policy::key::kManagedBookmarks)) |
261 return connector->GetManagementDomain(); | 267 return connector->GetManagementDomain(); |
262 return std::string(); | 268 return std::string(); |
263 } | 269 } |
OLD | NEW |