OLD | NEW |
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/history/android/android_provider_backend.h" | 5 #include "chrome/browser/history/android/android_provider_backend.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
16 #include "chrome/browser/chrome_notification_types.h" | |
17 #include "chrome/browser/history/chrome_history_client.h" | 16 #include "chrome/browser/history/chrome_history_client.h" |
18 #include "chrome/browser/history/chrome_history_client_factory.h" | 17 #include "chrome/browser/history/chrome_history_client_factory.h" |
19 #include "chrome/browser/history/history_backend.h" | 18 #include "chrome/browser/history/history_backend.h" |
20 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
21 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
22 #include "chrome/test/base/testing_browser_process.h" | 21 #include "chrome/test/base/testing_browser_process.h" |
23 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
24 #include "chrome/test/base/testing_profile_manager.h" | 23 #include "chrome/test/base/testing_profile_manager.h" |
25 #include "components/bookmarks/browser/bookmark_model.h" | 24 #include "components/bookmarks/browser/bookmark_model.h" |
26 #include "components/bookmarks/test/bookmark_test_helpers.h" | 25 #include "components/bookmarks/test/bookmark_test_helpers.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void NotifyFaviconChanged(const std::set<GURL>& url) override { | 79 void NotifyFaviconChanged(const std::set<GURL>& url) override { |
81 favicon_changed_.reset(new std::set<GURL>(url.begin(), url.end())); | 80 favicon_changed_.reset(new std::set<GURL>(url.begin(), url.end())); |
82 } | 81 } |
83 void NotifyURLVisited(ui::PageTransition, | 82 void NotifyURLVisited(ui::PageTransition, |
84 const history::URLRow& row, | 83 const history::URLRow& row, |
85 const history::RedirectList& redirects, | 84 const history::RedirectList& redirects, |
86 base::Time visit_time) override {} | 85 base::Time visit_time) override {} |
87 void NotifyURLsModified(const history::URLRows& rows) override { | 86 void NotifyURLsModified(const history::URLRows& rows) override { |
88 modified_details_.reset(new history::URLRows(rows)); | 87 modified_details_.reset(new history::URLRows(rows)); |
89 } | 88 } |
| 89 void NotifyURLsDeleted(bool all_history, |
| 90 bool expired, |
| 91 const URLRows& deleted_rows, |
| 92 const std::set<GURL>& favicon_urls) override { |
| 93 deleted_details_.reset(new history::URLRows(deleted_rows)); |
| 94 } |
90 void NotifyKeywordSearchTermUpdated(const URLRow& row, | 95 void NotifyKeywordSearchTermUpdated(const URLRow& row, |
91 KeywordID keyword_id, | 96 KeywordID keyword_id, |
92 const base::string16& term) override {} | 97 const base::string16& term) override {} |
93 void NotifyKeywordSearchTermDeleted(URLID url_id) override {} | 98 void NotifyKeywordSearchTermDeleted(URLID url_id) override {} |
94 void BroadcastNotifications( | |
95 int type, | |
96 scoped_ptr<HistoryDetails> details) override { | |
97 DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URLS_DELETED); | |
98 scoped_ptr<URLsDeletedDetails> urls_deleted_details( | |
99 static_cast<URLsDeletedDetails*>(details.release())); | |
100 deleted_details_.reset(new history::URLRows(urls_deleted_details->rows)); | |
101 } | |
102 void DBLoaded() override {} | 99 void DBLoaded() override {} |
103 | 100 |
104 history::URLRows* deleted_details() const { return deleted_details_.get(); } | 101 history::URLRows* deleted_details() const { return deleted_details_.get(); } |
105 | 102 |
106 history::URLRows* modified_details() const { return modified_details_.get(); } | 103 history::URLRows* modified_details() const { return modified_details_.get(); } |
107 | 104 |
108 std::set<GURL>* favicon_changed() const { return favicon_changed_.get(); } | 105 std::set<GURL>* favicon_changed() const { return favicon_changed_.get(); } |
109 | 106 |
110 void ResetDetails() { | 107 void ResetDetails() { |
111 deleted_details_.reset(); | 108 deleted_details_.reset(); |
(...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2150 update_args, &update_count)); | 2147 update_args, &update_count)); |
2151 // Verify notifications. | 2148 // Verify notifications. |
2152 EXPECT_FALSE(notifier_.deleted_details()); | 2149 EXPECT_FALSE(notifier_.deleted_details()); |
2153 ASSERT_TRUE(notifier_.modified_details()); | 2150 ASSERT_TRUE(notifier_.modified_details()); |
2154 ASSERT_EQ(1u, notifier_.modified_details()->size()); | 2151 ASSERT_EQ(1u, notifier_.modified_details()->size()); |
2155 // No favicon will be updated as thumbnail database is missing. | 2152 // No favicon will be updated as thumbnail database is missing. |
2156 EXPECT_FALSE(notifier_.favicon_changed()); | 2153 EXPECT_FALSE(notifier_.favicon_changed()); |
2157 } | 2154 } |
2158 | 2155 |
2159 } // namespace history | 2156 } // namespace history |
OLD | NEW |