| 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/history/chrome_history_client.h" | 5 #include "chrome/browser/history/chrome_history_client.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 "base/memory/ptr_util.h" |
| 11 #include "chrome/browser/history/chrome_history_backend_client.h" | 11 #include "chrome/browser/history/chrome_history_backend_client.h" |
| 12 #include "chrome/browser/history/history_utils.h" | 12 #include "chrome/browser/history/history_utils.h" |
| 13 #include "chrome/browser/profiles/sql_init_error_message_ids.h" |
| 13 #include "chrome/browser/ui/profile_error_dialog.h" | 14 #include "chrome/browser/ui/profile_error_dialog.h" |
| 14 #include "chrome/grit/chromium_strings.h" | |
| 15 #include "chrome/grit/generated_resources.h" | |
| 16 #include "components/bookmarks/browser/bookmark_model.h" | 15 #include "components/bookmarks/browser/bookmark_model.h" |
| 17 #include "components/history/core/browser/history_service.h" | 16 #include "components/history/core/browser/history_service.h" |
| 18 | 17 |
| 19 ChromeHistoryClient::ChromeHistoryClient( | 18 ChromeHistoryClient::ChromeHistoryClient( |
| 20 bookmarks::BookmarkModel* bookmark_model) | 19 bookmarks::BookmarkModel* bookmark_model) |
| 21 : bookmark_model_(bookmark_model), is_bookmark_model_observer_(false) { | 20 : bookmark_model_(bookmark_model), is_bookmark_model_observer_(false) { |
| 22 } | 21 } |
| 23 | 22 |
| 24 ChromeHistoryClient::~ChromeHistoryClient() { | 23 ChromeHistoryClient::~ChromeHistoryClient() { |
| 25 } | 24 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 58 } |
| 60 } | 59 } |
| 61 | 60 |
| 62 bool ChromeHistoryClient::CanAddURL(const GURL& url) { | 61 bool ChromeHistoryClient::CanAddURL(const GURL& url) { |
| 63 return CanAddURLToHistory(url); | 62 return CanAddURLToHistory(url); |
| 64 } | 63 } |
| 65 | 64 |
| 66 void ChromeHistoryClient::NotifyProfileError(sql::InitStatus init_status, | 65 void ChromeHistoryClient::NotifyProfileError(sql::InitStatus init_status, |
| 67 const std::string& diagnostics) { | 66 const std::string& diagnostics) { |
| 68 ShowProfileErrorDialog(PROFILE_ERROR_HISTORY, | 67 ShowProfileErrorDialog(PROFILE_ERROR_HISTORY, |
| 69 (init_status == sql::INIT_FAILURE) | 68 SqlInitStatusToMessageId(init_status), diagnostics); |
| 70 ? IDS_COULDNT_OPEN_PROFILE_ERROR | |
| 71 : IDS_PROFILE_TOO_NEW_ERROR, | |
| 72 diagnostics); | |
| 73 } | 69 } |
| 74 | 70 |
| 75 std::unique_ptr<history::HistoryBackendClient> | 71 std::unique_ptr<history::HistoryBackendClient> |
| 76 ChromeHistoryClient::CreateBackendClient() { | 72 ChromeHistoryClient::CreateBackendClient() { |
| 77 return base::WrapUnique(new ChromeHistoryBackendClient(bookmark_model_)); | 73 return base::WrapUnique(new ChromeHistoryBackendClient(bookmark_model_)); |
| 78 } | 74 } |
| 79 | 75 |
| 80 void ChromeHistoryClient::BookmarkModelChanged() { | 76 void ChromeHistoryClient::BookmarkModelChanged() { |
| 81 } | 77 } |
| 82 | 78 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 93 } | 89 } |
| 94 | 90 |
| 95 void ChromeHistoryClient::BookmarkAllUserNodesRemoved( | 91 void ChromeHistoryClient::BookmarkAllUserNodesRemoved( |
| 96 bookmarks::BookmarkModel* bookmark_model, | 92 bookmarks::BookmarkModel* bookmark_model, |
| 97 const std::set<GURL>& removed_urls) { | 93 const std::set<GURL>& removed_urls) { |
| 98 BaseBookmarkModelObserver::BookmarkAllUserNodesRemoved(bookmark_model, | 94 BaseBookmarkModelObserver::BookmarkAllUserNodesRemoved(bookmark_model, |
| 99 removed_urls); | 95 removed_urls); |
| 100 DCHECK(!on_bookmarks_removed_.is_null()); | 96 DCHECK(!on_bookmarks_removed_.is_null()); |
| 101 on_bookmarks_removed_.Run(removed_urls); | 97 on_bookmarks_removed_.Run(removed_urls); |
| 102 } | 98 } |
| OLD | NEW |