| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/metrics/user_metrics.h" |
| 9 #include "chrome/browser/favicon/favicon_service_factory.h" | 10 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 10 #include "chrome/browser/history/history_service_factory.h" | 11 #include "chrome/browser/history/history_service_factory.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "components/bookmarks/browser/bookmark_model.h" | 13 #include "components/bookmarks/browser/bookmark_model.h" |
| 13 #include "components/bookmarks/browser/bookmark_node.h" | 14 #include "components/bookmarks/browser/bookmark_node.h" |
| 14 #include "components/bookmarks/browser/bookmark_storage.h" | 15 #include "components/bookmarks/browser/bookmark_storage.h" |
| 15 #include "components/bookmarks/managed/managed_bookmark_service.h" | 16 #include "components/bookmarks/managed/managed_bookmark_service.h" |
| 16 #include "components/bookmarks/managed/managed_bookmark_util.h" | 17 #include "components/bookmarks/managed/managed_bookmark_util.h" |
| 17 #include "components/favicon/core/favicon_util.h" | 18 #include "components/favicon/core/favicon_util.h" |
| 18 #include "components/history/core/browser/history_service.h" | 19 #include "components/history/core/browser/history_service.h" |
| 19 #include "components/history/core/browser/url_database.h" | 20 #include "components/history/core/browser/url_database.h" |
| 20 #include "content/public/browser/user_metrics.h" | |
| 21 | 21 |
| 22 #if defined(OS_ANDROID) | 22 #if defined(OS_ANDROID) |
| 23 #include "chrome/browser/android/offline_pages/offline_page_bookmark_observer.h" | 23 #include "chrome/browser/android/offline_pages/offline_page_bookmark_observer.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 ChromeBookmarkClient::ChromeBookmarkClient( | 26 ChromeBookmarkClient::ChromeBookmarkClient( |
| 27 Profile* profile, | 27 Profile* profile, |
| 28 bookmarks::ManagedBookmarkService* managed_bookmark_service) | 28 bookmarks::ManagedBookmarkService* managed_bookmark_service) |
| 29 : profile_(profile), managed_bookmark_service_(managed_bookmark_service) {} | 29 : profile_(profile), managed_bookmark_service_(managed_bookmark_service) {} |
| 30 | 30 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (bookmarks::IsManagedNode(node, managed_bookmark_service_)) | 90 if (bookmarks::IsManagedNode(node, managed_bookmark_service_)) |
| 91 return false; | 91 return false; |
| 92 #if defined(OS_ANDROID) | 92 #if defined(OS_ANDROID) |
| 93 return node->type() == bookmarks::BookmarkNode::MOBILE; | 93 return node->type() == bookmarks::BookmarkNode::MOBILE; |
| 94 #else | 94 #else |
| 95 return node->type() != bookmarks::BookmarkNode::MOBILE; | 95 return node->type() != bookmarks::BookmarkNode::MOBILE; |
| 96 #endif | 96 #endif |
| 97 } | 97 } |
| 98 | 98 |
| 99 void ChromeBookmarkClient::RecordAction(const base::UserMetricsAction& action) { | 99 void ChromeBookmarkClient::RecordAction(const base::UserMetricsAction& action) { |
| 100 content::RecordAction(action); | 100 base::RecordAction(action); |
| 101 } | 101 } |
| 102 | 102 |
| 103 bookmarks::LoadExtraCallback ChromeBookmarkClient::GetLoadExtraNodesCallback() { | 103 bookmarks::LoadExtraCallback ChromeBookmarkClient::GetLoadExtraNodesCallback() { |
| 104 if (!managed_bookmark_service_) | 104 if (!managed_bookmark_service_) |
| 105 return bookmarks::LoadExtraCallback(); | 105 return bookmarks::LoadExtraCallback(); |
| 106 | 106 |
| 107 return managed_bookmark_service_->GetLoadExtraNodesCallback(); | 107 return managed_bookmark_service_->GetLoadExtraNodesCallback(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool ChromeBookmarkClient::CanSetPermanentNodeTitle( | 110 bool ChromeBookmarkClient::CanSetPermanentNodeTitle( |
| 111 const bookmarks::BookmarkNode* permanent_node) { | 111 const bookmarks::BookmarkNode* permanent_node) { |
| 112 return !managed_bookmark_service_ | 112 return !managed_bookmark_service_ |
| 113 ? true | 113 ? true |
| 114 : managed_bookmark_service_->CanSetPermanentNodeTitle( | 114 : managed_bookmark_service_->CanSetPermanentNodeTitle( |
| 115 permanent_node); | 115 permanent_node); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool ChromeBookmarkClient::CanSyncNode(const bookmarks::BookmarkNode* node) { | 118 bool ChromeBookmarkClient::CanSyncNode(const bookmarks::BookmarkNode* node) { |
| 119 return !managed_bookmark_service_ | 119 return !managed_bookmark_service_ |
| 120 ? true | 120 ? true |
| 121 : managed_bookmark_service_->CanSyncNode(node); | 121 : managed_bookmark_service_->CanSyncNode(node); |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool ChromeBookmarkClient::CanBeEditedByUser( | 124 bool ChromeBookmarkClient::CanBeEditedByUser( |
| 125 const bookmarks::BookmarkNode* node) { | 125 const bookmarks::BookmarkNode* node) { |
| 126 return !managed_bookmark_service_ | 126 return !managed_bookmark_service_ |
| 127 ? true | 127 ? true |
| 128 : managed_bookmark_service_->CanBeEditedByUser(node); | 128 : managed_bookmark_service_->CanBeEditedByUser(node); |
| 129 } | 129 } |
| OLD | NEW |