Index: chrome/renderer/searchbox/searchbox.cc |
diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc |
index 2483b30b6bf7e6d8d4f2cb8fa48d8e583f45cc18..8e8374de3f686c23fbaac726c99c8525c134d441 100644 |
--- a/chrome/renderer/searchbox/searchbox.cc |
+++ b/chrome/renderer/searchbox/searchbox.cc |
@@ -332,6 +332,9 @@ void SearchBox::OnSetDisplayInstantResults(bool display_instant_results) { |
} |
void SearchBox::OnThemeChanged(const ThemeBackgroundInfo& theme_info) { |
+ if (theme_info == theme_info_) { |
samarth
2013/05/03 21:24:42
nit: no braces for 1-line conditionals in Chrome.
|
+ return; |
+ } |
theme_info_ = theme_info; |
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
extensions_v8::SearchBoxExtension::DispatchThemeChange( |
@@ -373,6 +376,25 @@ void SearchBox::Reset() { |
void SearchBox::OnMostVisitedChanged( |
const std::vector<InstantMostVisitedItemIDPair>& items) { |
+ std::vector<InstantMostVisitedItemIDPair> oldItems; |
+ most_visited_items_cache_.GetCurrentItems(&oldItems); |
+ |
+ bool most_visited_changed = oldItems.size() != items.size(); |
samarth
2013/05/03 21:24:42
if (oldsize != newsize)
return;
|
+ if (!most_visited_changed) { |
+ for (size_t i = 0; i < items.size(); i++) { |
+ InstantMostVisitedItem oldItem = oldItems[i].second; |
+ InstantMostVisitedItem newItem = items[i].second; |
+ if (newItem.url != oldItem.url || newItem.title != oldItem.title) { |
+ most_visited_changed = true; |
samarth
2013/05/03 21:24:42
Just return here.
|
+ break; |
+ } |
+ } |
+ } |
+ |
+ if (!most_visited_changed) { |
+ return; |
+ } |
+ |
most_visited_items_cache_.AddItemsWithRestrictedID(items); |
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |