Chromium Code Reviews| Index: chrome/renderer/searchbox/searchbox.cc |
| diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc |
| index 2483b30b6bf7e6d8d4f2cb8fa48d8e583f45cc18..10b021ca179cd2b1ed565f02d3b11751240cfde3 100644 |
| --- a/chrome/renderer/searchbox/searchbox.cc |
| +++ b/chrome/renderer/searchbox/searchbox.cc |
| @@ -331,7 +331,24 @@ void SearchBox::OnSetDisplayInstantResults(bool display_instant_results) { |
| display_instant_results_ = display_instant_results; |
| } |
| +bool SearchBox::DidThemeInfoChange(const ThemeBackgroundInfo& theme_info) { |
|
samarth
2013/05/03 22:18:45
nit: Please move the anonymous namespace at the to
|
| + return theme_info_.color_r != theme_info.color_r || |
| + theme_info_.color_g != theme_info.color_g || |
| + theme_info_.color_b != theme_info.color_b || |
| + theme_info_.color_a != theme_info.color_a || |
| + theme_info_.theme_id != theme_info.theme_id || |
| + theme_info_.image_horizontal_alignment != |
| + theme_info.image_horizontal_alignment || |
| + theme_info_.image_vertical_alignment != |
| + theme_info.image_vertical_alignment || |
| + theme_info_.image_tiling != theme_info.image_tiling || |
| + theme_info_.image_height != theme_info.image_height || |
| + theme_info_.has_attribution != theme_info.has_attribution; |
|
samarth
2013/05/03 22:18:45
Please also add a comment in instant_types.h to ke
|
| +} |
| + |
| void SearchBox::OnThemeChanged(const ThemeBackgroundInfo& theme_info) { |
| + if (!DidThemeInfoChange(theme_info)) |
| + return; |
| theme_info_ = theme_info; |
| if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
| extensions_v8::SearchBoxExtension::DispatchThemeChange( |
| @@ -371,8 +388,29 @@ void SearchBox::Reset() { |
| // changes. |
| } |
| +bool SearchBox::DidMostVisitedItemsChange( |
|
samarth
2013/05/03 22:18:45
Likewise (anonymous namespace please).
|
| + const std::vector<InstantMostVisitedItemIDPair>& items) { |
| + std::vector<InstantMostVisitedItemIDPair> oldItems; |
| + most_visited_items_cache_.GetCurrentItems(&oldItems); |
| + bool most_visited_changed = oldItems.size() != items.size(); |
| + 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; |
| + break; |
| + } |
| + } |
| + } |
| + return most_visited_changed; |
| +} |
| + |
| void SearchBox::OnMostVisitedChanged( |
| const std::vector<InstantMostVisitedItemIDPair>& items) { |
| + if (!DidMostVisitedItemsChange(items)) |
| + return; |
| + |
| most_visited_items_cache_.AddItemsWithRestrictedID(items); |
| if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |