| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/history/history_client_impl.h" | 5 #include "ios/chrome/browser/history/history_client_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" |
| 10 #include "components/bookmarks/browser/bookmark_model.h" | 11 #include "components/bookmarks/browser/bookmark_model.h" |
| 11 #include "components/history/core/browser/history_service.h" | 12 #include "components/history/core/browser/history_service.h" |
| 12 #include "ios/chrome/browser/history/history_backend_client_impl.h" | 13 #include "ios/chrome/browser/history/history_backend_client_impl.h" |
| 13 #include "ios/chrome/browser/history/history_utils.h" | 14 #include "ios/chrome/browser/history/history_utils.h" |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 | 16 |
| 16 HistoryClientImpl::HistoryClientImpl(bookmarks::BookmarkModel* bookmark_model) | 17 HistoryClientImpl::HistoryClientImpl(bookmarks::BookmarkModel* bookmark_model) |
| 17 : bookmark_model_(bookmark_model), is_bookmark_model_observer_(false) { | 18 : bookmark_model_(bookmark_model), is_bookmark_model_observer_(false) { |
| 18 } | 19 } |
| 19 | 20 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 58 bool HistoryClientImpl::CanAddURL(const GURL& url) { | 59 bool HistoryClientImpl::CanAddURL(const GURL& url) { |
| 59 return ios::CanAddURLToHistory(url); | 60 return ios::CanAddURLToHistory(url); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void HistoryClientImpl::NotifyProfileError(sql::InitStatus init_status) { | 63 void HistoryClientImpl::NotifyProfileError(sql::InitStatus init_status) { |
| 63 } | 64 } |
| 64 | 65 |
| 65 scoped_ptr<history::HistoryBackendClient> | 66 std::unique_ptr<history::HistoryBackendClient> |
| 66 HistoryClientImpl::CreateBackendClient() { | 67 HistoryClientImpl::CreateBackendClient() { |
| 67 return make_scoped_ptr(new HistoryBackendClientImpl(bookmark_model_)); | 68 return base::WrapUnique(new HistoryBackendClientImpl(bookmark_model_)); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void HistoryClientImpl::BookmarkModelChanged() { | 71 void HistoryClientImpl::BookmarkModelChanged() { |
| 71 } | 72 } |
| 72 | 73 |
| 73 void HistoryClientImpl::BookmarkNodeRemoved( | 74 void HistoryClientImpl::BookmarkNodeRemoved( |
| 74 bookmarks::BookmarkModel* model, | 75 bookmarks::BookmarkModel* model, |
| 75 const bookmarks::BookmarkNode* parent, | 76 const bookmarks::BookmarkNode* parent, |
| 76 int old_index, | 77 int old_index, |
| 77 const bookmarks::BookmarkNode* node, | 78 const bookmarks::BookmarkNode* node, |
| 78 const std::set<GURL>& no_longer_bookmarked) { | 79 const std::set<GURL>& no_longer_bookmarked) { |
| 79 if (!on_bookmarks_removed_.is_null()) | 80 if (!on_bookmarks_removed_.is_null()) |
| 80 on_bookmarks_removed_.Run(no_longer_bookmarked); | 81 on_bookmarks_removed_.Run(no_longer_bookmarked); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void HistoryClientImpl::BookmarkAllUserNodesRemoved( | 84 void HistoryClientImpl::BookmarkAllUserNodesRemoved( |
| 84 bookmarks::BookmarkModel* model, | 85 bookmarks::BookmarkModel* model, |
| 85 const std::set<GURL>& removed_urls) { | 86 const std::set<GURL>& removed_urls) { |
| 86 if (!on_bookmarks_removed_.is_null()) | 87 if (!on_bookmarks_removed_.is_null()) |
| 87 on_bookmarks_removed_.Run(removed_urls); | 88 on_bookmarks_removed_.Run(removed_urls); |
| 88 } | 89 } |
| OLD | NEW |