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/android/android_time.h" | 16 #include "chrome/browser/history/android/android_time.h" |
18 #include "chrome/browser/history/chrome_history_client.h" | 17 #include "chrome/browser/history/chrome_history_client.h" |
19 #include "chrome/browser/history/chrome_history_client_factory.h" | 18 #include "chrome/browser/history/chrome_history_client_factory.h" |
20 #include "chrome/browser/history/history_backend.h" | 19 #include "chrome/browser/history/history_backend.h" |
21 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
22 #include "chrome/common/chrome_constants.h" | 21 #include "chrome/common/chrome_constants.h" |
23 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
24 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
25 #include "chrome/test/base/testing_profile_manager.h" | 24 #include "chrome/test/base/testing_profile_manager.h" |
26 #include "components/bookmarks/browser/bookmark_model.h" | 25 #include "components/bookmarks/browser/bookmark_model.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void NotifyFaviconChanged(const std::set<GURL>& url) override { | 76 void NotifyFaviconChanged(const std::set<GURL>& url) override { |
78 favicon_changed_.reset(new std::set<GURL>(url.begin(), url.end())); | 77 favicon_changed_.reset(new std::set<GURL>(url.begin(), url.end())); |
79 } | 78 } |
80 void NotifyURLVisited(ui::PageTransition, | 79 void NotifyURLVisited(ui::PageTransition, |
81 const history::URLRow& row, | 80 const history::URLRow& row, |
82 const history::RedirectList& redirects, | 81 const history::RedirectList& redirects, |
83 base::Time visit_time) override {} | 82 base::Time visit_time) override {} |
84 void NotifyURLsModified(const history::URLRows& rows) override { | 83 void NotifyURLsModified(const history::URLRows& rows) override { |
85 modified_details_.reset(new history::URLRows(rows)); | 84 modified_details_.reset(new history::URLRows(rows)); |
86 } | 85 } |
| 86 void NotifyURLsDeleted(bool all_history, |
| 87 bool expired, |
| 88 const URLRows& deleted_rows, |
| 89 const std::set<GURL>& favicon_urls) override { |
| 90 deleted_details_.reset(new history::URLRows(deleted_rows)); |
| 91 } |
87 void BroadcastNotifications( | 92 void BroadcastNotifications( |
88 int type, | 93 int type, |
89 scoped_ptr<HistoryDetails> details) override { | 94 scoped_ptr<HistoryDetails> details) override { |
90 DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URLS_DELETED); | 95 NOTREACHED(); |
91 scoped_ptr<URLsDeletedDetails> urls_deleted_details( | |
92 static_cast<URLsDeletedDetails*>(details.release())); | |
93 deleted_details_.reset(new history::URLRows(urls_deleted_details->rows)); | |
94 } | 96 } |
95 void DBLoaded() override {} | 97 void DBLoaded() override {} |
96 | 98 |
97 history::URLRows* deleted_details() const { return deleted_details_.get(); } | 99 history::URLRows* deleted_details() const { return deleted_details_.get(); } |
98 | 100 |
99 history::URLRows* modified_details() const { return modified_details_.get(); } | 101 history::URLRows* modified_details() const { return modified_details_.get(); } |
100 | 102 |
101 std::set<GURL>* favicon_changed() const { return favicon_changed_.get(); } | 103 std::set<GURL>* favicon_changed() const { return favicon_changed_.get(); } |
102 | 104 |
103 void ResetDetails() { | 105 void ResetDetails() { |
(...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 update_args, &update_count)); | 2144 update_args, &update_count)); |
2143 // Verify notifications. | 2145 // Verify notifications. |
2144 EXPECT_FALSE(notifier_.deleted_details()); | 2146 EXPECT_FALSE(notifier_.deleted_details()); |
2145 ASSERT_TRUE(notifier_.modified_details()); | 2147 ASSERT_TRUE(notifier_.modified_details()); |
2146 ASSERT_EQ(1u, notifier_.modified_details()->size()); | 2148 ASSERT_EQ(1u, notifier_.modified_details()->size()); |
2147 // No favicon will be updated as thumbnail database is missing. | 2149 // No favicon will be updated as thumbnail database is missing. |
2148 EXPECT_FALSE(notifier_.favicon_changed()); | 2150 EXPECT_FALSE(notifier_.favicon_changed()); |
2149 } | 2151 } |
2150 | 2152 |
2151 } // namespace history | 2153 } // namespace history |
OLD | NEW |