Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: chrome/browser/search/instant_service.cc

Issue 17521002: Added a check in Searchbox::OnMostVisitedChanged() to prevent duplicate notifications regarding mos… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/search/search.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/search/instant_service.h" 5 #include "chrome/browser/search/instant_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 history::TopSites::MaybeShuffle(&reordered_data); 214 history::TopSites::MaybeShuffle(&reordered_data);
215 215
216 std::vector<InstantMostVisitedItem> new_most_visited_items; 216 std::vector<InstantMostVisitedItem> new_most_visited_items;
217 for (size_t i = 0; i < reordered_data.size(); i++) { 217 for (size_t i = 0; i < reordered_data.size(); i++) {
218 const history::MostVisitedURL& url = reordered_data[i]; 218 const history::MostVisitedURL& url = reordered_data[i];
219 InstantMostVisitedItem item; 219 InstantMostVisitedItem item;
220 item.url = url.url; 220 item.url = url.url;
221 item.title = url.title; 221 item.title = url.title;
222 new_most_visited_items.push_back(item); 222 new_most_visited_items.push_back(item);
223 } 223 }
224 if (chrome::AreMostVisitedItemsEqual(new_most_visited_items,
225 most_visited_items_)) {
226 return;
227 }
228 224
229 most_visited_items_ = new_most_visited_items; 225 most_visited_items_ = new_most_visited_items;
230 226
231 const BrowserList* browser_list = 227 const BrowserList* browser_list =
232 BrowserList::GetInstance(chrome::GetActiveDesktop()); 228 BrowserList::GetInstance(chrome::GetActiveDesktop());
233 for (BrowserList::const_iterator it = browser_list->begin(); 229 for (BrowserList::const_iterator it = browser_list->begin();
234 it != browser_list->end(); ++it) { 230 it != browser_list->end(); ++it) {
235 if ((*it)->profile() != profile_ || !((*it)->instant_controller())) 231 if ((*it)->profile() != profile_ || !((*it)->instant_controller()))
236 continue; 232 continue;
237 233
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 DCHECK(image); 312 DCHECK(image);
317 theme_info_->image_height = image->height(); 313 theme_info_->image_height = image->height();
318 314
319 theme_info_->has_attribution = 315 theme_info_->has_attribution =
320 theme_service->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION); 316 theme_service->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION);
321 } 317 }
322 318
323 FOR_EACH_OBSERVER(InstantServiceObserver, observers_, 319 FOR_EACH_OBSERVER(InstantServiceObserver, observers_,
324 ThemeInfoChanged(*theme_info_)); 320 ThemeInfoChanged(*theme_info_));
325 } 321 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search/search.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698