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" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 bitmap.eraseColor(SK_ColorBLUE); | 62 bitmap.eraseColor(SK_ColorBLUE); |
63 return bitmap; | 63 return bitmap; |
64 } | 64 } |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 class AndroidProviderBackendDelegate : public HistoryBackend::Delegate { | 68 class AndroidProviderBackendDelegate : public HistoryBackend::Delegate { |
69 public: | 69 public: |
70 AndroidProviderBackendDelegate() {} | 70 AndroidProviderBackendDelegate() {} |
71 | 71 |
72 virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE {} | 72 virtual void NotifyProfileError(sql::InitStatus init_status) override {} |
73 virtual void SetInMemoryBackend( | 73 virtual void SetInMemoryBackend( |
74 scoped_ptr<InMemoryHistoryBackend> backend) OVERRIDE {} | 74 scoped_ptr<InMemoryHistoryBackend> backend) override {} |
75 virtual void NotifyFaviconChanged(const std::set<GURL>& url) OVERRIDE { | 75 virtual void NotifyFaviconChanged(const std::set<GURL>& url) override { |
76 favicon_changed_.reset(new std::set<GURL>(url.begin(), url.end())); | 76 favicon_changed_.reset(new std::set<GURL>(url.begin(), url.end())); |
77 } | 77 } |
78 virtual void BroadcastNotifications( | 78 virtual void BroadcastNotifications( |
79 int type, | 79 int type, |
80 scoped_ptr<HistoryDetails> details) OVERRIDE { | 80 scoped_ptr<HistoryDetails> details) override { |
81 switch (type) { | 81 switch (type) { |
82 case chrome::NOTIFICATION_HISTORY_URLS_DELETED: | 82 case chrome::NOTIFICATION_HISTORY_URLS_DELETED: |
83 deleted_details_.reset( | 83 deleted_details_.reset( |
84 static_cast<URLsDeletedDetails*>(details.release())); | 84 static_cast<URLsDeletedDetails*>(details.release())); |
85 break; | 85 break; |
86 case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED: | 86 case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED: |
87 modified_details_.reset( | 87 modified_details_.reset( |
88 static_cast<URLsModifiedDetails*>(details.release())); | 88 static_cast<URLsModifiedDetails*>(details.release())); |
89 break; | 89 break; |
90 } | 90 } |
91 } | 91 } |
92 virtual void DBLoaded() OVERRIDE {} | 92 virtual void DBLoaded() override {} |
93 virtual void NotifyVisitDBObserversOnAddVisit( | 93 virtual void NotifyVisitDBObserversOnAddVisit( |
94 const history::BriefVisitInfo& info) OVERRIDE {} | 94 const history::BriefVisitInfo& info) override {} |
95 | 95 |
96 URLsDeletedDetails* deleted_details() const { | 96 URLsDeletedDetails* deleted_details() const { |
97 return deleted_details_.get(); | 97 return deleted_details_.get(); |
98 } | 98 } |
99 | 99 |
100 URLsModifiedDetails* modified_details() const { | 100 URLsModifiedDetails* modified_details() const { |
101 return modified_details_.get(); | 101 return modified_details_.get(); |
102 } | 102 } |
103 | 103 |
104 std::set<GURL>* favicon_changed() const { return favicon_changed_.get(); } | 104 std::set<GURL>* favicon_changed() const { return favicon_changed_.get(); } |
(...skipping 18 matching lines...) Expand all Loading... |
123 : thumbnail_db_(NULL), | 123 : thumbnail_db_(NULL), |
124 profile_manager_( | 124 profile_manager_( |
125 TestingBrowserProcess::GetGlobal()), | 125 TestingBrowserProcess::GetGlobal()), |
126 bookmark_model_(NULL), | 126 bookmark_model_(NULL), |
127 ui_thread_(BrowserThread::UI, &message_loop_), | 127 ui_thread_(BrowserThread::UI, &message_loop_), |
128 file_thread_(BrowserThread::FILE, &message_loop_) { | 128 file_thread_(BrowserThread::FILE, &message_loop_) { |
129 } | 129 } |
130 virtual ~AndroidProviderBackendTest() {} | 130 virtual ~AndroidProviderBackendTest() {} |
131 | 131 |
132 protected: | 132 protected: |
133 virtual void SetUp() OVERRIDE { | 133 virtual void SetUp() override { |
134 // Setup the testing profile, so the bookmark_model_sql_handler could | 134 // Setup the testing profile, so the bookmark_model_sql_handler could |
135 // get the bookmark model from it. | 135 // get the bookmark model from it. |
136 ASSERT_TRUE(profile_manager_.SetUp()); | 136 ASSERT_TRUE(profile_manager_.SetUp()); |
137 // It seems that the name has to be chrome::kInitialProfile, so it | 137 // It seems that the name has to be chrome::kInitialProfile, so it |
138 // could be found by ProfileManager::GetLastUsedProfile(). | 138 // could be found by ProfileManager::GetLastUsedProfile(). |
139 TestingProfile* testing_profile = profile_manager_.CreateTestingProfile( | 139 TestingProfile* testing_profile = profile_manager_.CreateTestingProfile( |
140 chrome::kInitialProfile); | 140 chrome::kInitialProfile); |
141 testing_profile->CreateBookmarkModel(true); | 141 testing_profile->CreateBookmarkModel(true); |
142 bookmark_model_ = BookmarkModelFactory::GetForProfile(testing_profile); | 142 bookmark_model_ = BookmarkModelFactory::GetForProfile(testing_profile); |
143 history_client_ = | 143 history_client_ = |
(...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 update_args, &update_count)); | 2104 update_args, &update_count)); |
2105 // Verify notifications. | 2105 // Verify notifications. |
2106 EXPECT_FALSE(delegate_.deleted_details()); | 2106 EXPECT_FALSE(delegate_.deleted_details()); |
2107 ASSERT_TRUE(delegate_.modified_details()); | 2107 ASSERT_TRUE(delegate_.modified_details()); |
2108 ASSERT_EQ(1u, delegate_.modified_details()->changed_urls.size()); | 2108 ASSERT_EQ(1u, delegate_.modified_details()->changed_urls.size()); |
2109 // No favicon will be updated as thumbnail database is missing. | 2109 // No favicon will be updated as thumbnail database is missing. |
2110 EXPECT_FALSE(delegate_.favicon_changed()); | 2110 EXPECT_FALSE(delegate_.favicon_changed()); |
2111 } | 2111 } |
2112 | 2112 |
2113 } // namespace history | 2113 } // namespace history |
OLD | NEW |