| 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 "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/history/android/android_time.h" | 9 #include "chrome/browser/history/android/android_time.h" |
| 10 #include "chrome/browser/history/android/android_urls_sql_handler.h" | 10 #include "chrome/browser/history/android/android_urls_sql_handler.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (!history_db_->GetURLRow(i->url_id, &url_row)) | 345 if (!history_db_->GetURLRow(i->url_id, &url_row)) |
| 346 return false; | 346 return false; |
| 347 modified->changed_urls.push_back(url_row); | 347 modified->changed_urls.push_back(url_row); |
| 348 } | 348 } |
| 349 if (thumbnail_db_ && | 349 if (thumbnail_db_ && |
| 350 row.is_value_set_explicitly(HistoryAndBookmarkRow::FAVICON)) | 350 row.is_value_set_explicitly(HistoryAndBookmarkRow::FAVICON)) |
| 351 favicon->insert(i->url); | 351 favicon->insert(i->url); |
| 352 } | 352 } |
| 353 | 353 |
| 354 if (!modified->changed_urls.empty()) { | 354 if (!modified->changed_urls.empty()) { |
| 355 scoped_ptr<HistoryDetails> details = modified.PassAs<HistoryDetails>(); | 355 scoped_ptr<HistoryDetails> details = modified.Pass(); |
| 356 notifications->push_back( | 356 notifications->push_back( |
| 357 base::Bind(&HistoryBackend::Delegate::BroadcastNotifications, | 357 base::Bind(&HistoryBackend::Delegate::BroadcastNotifications, |
| 358 base::Unretained(delegate_), | 358 base::Unretained(delegate_), |
| 359 chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, | 359 chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, |
| 360 base::Passed(&details))); | 360 base::Passed(&details))); |
| 361 } | 361 } |
| 362 | 362 |
| 363 if (!favicon->empty()) { | 363 if (!favicon->empty()) { |
| 364 notifications->push_back(base::Bind(&RunNotifyFaviconChanged, | 364 notifications->push_back(base::Bind(&RunNotifyFaviconChanged, |
| 365 base::Unretained(delegate_), | 365 base::Unretained(delegate_), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 396 modified->changed_urls.push_back(url_row); | 396 modified->changed_urls.push_back(url_row); |
| 397 | 397 |
| 398 scoped_ptr<std::set<GURL> > favicon; | 398 scoped_ptr<std::set<GURL> > favicon; |
| 399 // No favicon should be changed if the thumbnail_db_ is not available. | 399 // No favicon should be changed if the thumbnail_db_ is not available. |
| 400 if (row.is_value_set_explicitly(HistoryAndBookmarkRow::FAVICON) && | 400 if (row.is_value_set_explicitly(HistoryAndBookmarkRow::FAVICON) && |
| 401 row.favicon_valid() && thumbnail_db_) { | 401 row.favicon_valid() && thumbnail_db_) { |
| 402 favicon.reset(new std::set<GURL>); | 402 favicon.reset(new std::set<GURL>); |
| 403 favicon->insert(url_row.url()); | 403 favicon->insert(url_row.url()); |
| 404 } | 404 } |
| 405 | 405 |
| 406 scoped_ptr<HistoryDetails> details = modified.PassAs<HistoryDetails>(); | 406 scoped_ptr<HistoryDetails> details = modified.Pass(); |
| 407 notifications->push_back( | 407 notifications->push_back( |
| 408 base::Bind(&HistoryBackend::Delegate::BroadcastNotifications, | 408 base::Bind(&HistoryBackend::Delegate::BroadcastNotifications, |
| 409 base::Unretained(delegate_), | 409 base::Unretained(delegate_), |
| 410 chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, | 410 chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, |
| 411 base::Passed(&details))); | 411 base::Passed(&details))); |
| 412 | 412 |
| 413 if (favicon) { | 413 if (favicon) { |
| 414 DCHECK(!favicon->empty()); | 414 DCHECK(!favicon->empty()); |
| 415 notifications->push_back(base::Bind(&RunNotifyFaviconChanged, | 415 notifications->push_back(base::Bind(&RunNotifyFaviconChanged, |
| 416 base::Unretained(delegate_), | 416 base::Unretained(delegate_), |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 | 1059 |
| 1060 if (!bookmark_model_handler_->Insert(&new_row)) | 1060 if (!bookmark_model_handler_->Insert(&new_row)) |
| 1061 return false; | 1061 return false; |
| 1062 | 1062 |
| 1063 URLRow new_url_row; | 1063 URLRow new_url_row; |
| 1064 if (!history_db_->GetURLRow(new_row.url_id(), &new_url_row)) | 1064 if (!history_db_->GetURLRow(new_row.url_id(), &new_url_row)) |
| 1065 return false; | 1065 return false; |
| 1066 | 1066 |
| 1067 modified->changed_urls.push_back(new_url_row); | 1067 modified->changed_urls.push_back(new_url_row); |
| 1068 | 1068 |
| 1069 scoped_ptr<HistoryDetails> details = deleted_details.PassAs<HistoryDetails>(); | 1069 scoped_ptr<HistoryDetails> details = deleted_details.Pass(); |
| 1070 notifications->push_back( | 1070 notifications->push_back( |
| 1071 base::Bind(&HistoryBackend::Delegate::BroadcastNotifications, | 1071 base::Bind(&HistoryBackend::Delegate::BroadcastNotifications, |
| 1072 base::Unretained(delegate_), | 1072 base::Unretained(delegate_), |
| 1073 chrome::NOTIFICATION_HISTORY_URLS_DELETED, | 1073 chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
| 1074 base::Passed(&details))); | 1074 base::Passed(&details))); |
| 1075 if (favicons && !favicons->empty()) { | 1075 if (favicons && !favicons->empty()) { |
| 1076 notifications->push_back(base::Bind(&RunNotifyFaviconChanged, | 1076 notifications->push_back(base::Bind(&RunNotifyFaviconChanged, |
| 1077 base::Unretained(delegate_), | 1077 base::Unretained(delegate_), |
| 1078 base::Passed(&favicons))); | 1078 base::Passed(&favicons))); |
| 1079 } | 1079 } |
| 1080 scoped_ptr<HistoryDetails> other_details = modified.PassAs<HistoryDetails>(); | 1080 scoped_ptr<HistoryDetails> other_details = modified.Pass(); |
| 1081 notifications->push_back( | 1081 notifications->push_back( |
| 1082 base::Bind(&HistoryBackend::Delegate::BroadcastNotifications, | 1082 base::Bind(&HistoryBackend::Delegate::BroadcastNotifications, |
| 1083 base::Unretained(delegate_), | 1083 base::Unretained(delegate_), |
| 1084 chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, | 1084 chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, |
| 1085 base::Passed(&other_details))); | 1085 base::Passed(&other_details))); |
| 1086 | 1086 |
| 1087 return true; | 1087 return true; |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 AndroidStatement* AndroidProviderBackend::QueryHistoryAndBookmarksInternal( | 1090 AndroidStatement* AndroidProviderBackend::QueryHistoryAndBookmarksInternal( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 | 1139 |
| 1140 // Only invoke Delete on the BookmarkModelHandler if we need | 1140 // Only invoke Delete on the BookmarkModelHandler if we need |
| 1141 // to delete bookmarks. | 1141 // to delete bookmarks. |
| 1142 for (std::vector<SQLHandler*>::iterator i = | 1142 for (std::vector<SQLHandler*>::iterator i = |
| 1143 sql_handlers_.begin(); i != sql_handlers_.end(); ++i) { | 1143 sql_handlers_.begin(); i != sql_handlers_.end(); ++i) { |
| 1144 if ((*i) != bookmark_model_handler_.get() || delete_bookmarks) | 1144 if ((*i) != bookmark_model_handler_.get() || delete_bookmarks) |
| 1145 if (!(*i)->Delete(urls)) | 1145 if (!(*i)->Delete(urls)) |
| 1146 return false; | 1146 return false; |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 scoped_ptr<HistoryDetails> details = deleted_details.PassAs<HistoryDetails>(); | 1149 scoped_ptr<HistoryDetails> details = deleted_details.Pass(); |
| 1150 notifications->push_back( | 1150 notifications->push_back( |
| 1151 base::Bind(&HistoryBackend::Delegate::BroadcastNotifications, | 1151 base::Bind(&HistoryBackend::Delegate::BroadcastNotifications, |
| 1152 base::Unretained(delegate_), | 1152 base::Unretained(delegate_), |
| 1153 chrome::NOTIFICATION_HISTORY_URLS_DELETED, | 1153 chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
| 1154 base::Passed(&details))); | 1154 base::Passed(&details))); |
| 1155 if (favicon && !favicon->empty()) { | 1155 if (favicon && !favicon->empty()) { |
| 1156 notifications->push_back(base::Bind(&RunNotifyFaviconChanged, | 1156 notifications->push_back(base::Bind(&RunNotifyFaviconChanged, |
| 1157 base::Unretained(delegate_), | 1157 base::Unretained(delegate_), |
| 1158 base::Passed(&favicon))); | 1158 base::Passed(&favicon))); |
| 1159 } | 1159 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 return false; | 1213 return false; |
| 1214 | 1214 |
| 1215 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), | 1215 if (!history_db_->SetKeywordSearchTermsForURL(bookmark_row.url_id(), |
| 1216 values.keyword_id(), values.search_term())) | 1216 values.keyword_id(), values.search_term())) |
| 1217 return false; | 1217 return false; |
| 1218 } | 1218 } |
| 1219 return true; | 1219 return true; |
| 1220 } | 1220 } |
| 1221 | 1221 |
| 1222 } // namespace history | 1222 } // namespace history |
| OLD | NEW |