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

Side by Side Diff: chrome/browser/history/top_sites_extension_api.cc

Issue 9721013: Move topSites API out of experimental (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added curlies Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/top_sites_extension_api.h" 5 #include "chrome/browser/history/top_sites_extension_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/history/top_sites.h" 9 #include "chrome/browser/history/top_sites.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 11 matching lines...) Expand all
22 return false; 22 return false;
23 23
24 ts->GetMostVisitedURLs( 24 ts->GetMostVisitedURLs(
25 &topsites_consumer_, 25 &topsites_consumer_,
26 base::Bind(&GetTopSitesFunction::OnMostVisitedURLsAvailable, this)); 26 base::Bind(&GetTopSitesFunction::OnMostVisitedURLsAvailable, this));
27 return true; 27 return true;
28 } 28 }
29 29
30 void GetTopSitesFunction::OnMostVisitedURLsAvailable( 30 void GetTopSitesFunction::OnMostVisitedURLsAvailable(
31 const history::MostVisitedURLList& data) { 31 const history::MostVisitedURLList& data) {
32 // Code is a direct rip from most_visited_handler.cc TODO(estade): unfork.
33 scoped_ptr<base::ListValue> pages_value(new ListValue); 32 scoped_ptr<base::ListValue> pages_value(new ListValue);
34 for (size_t i = 0; i < data.size(); i++) { 33 for (size_t i = 0; i < data.size(); i++) {
35 const history::MostVisitedURL& url = data[i]; 34 const history::MostVisitedURL& url = data[i];
36 DictionaryValue* page_value = new DictionaryValue(); 35 DictionaryValue* page_value = new DictionaryValue();
37 if (url.url.is_empty()) { 36 if (!url.url.is_empty()) {
38 page_value->SetBoolean("filler", true); 37 NewTabUI::SetURLTitleAndDirection(page_value,
brettw 2012/03/21 18:16:01 I don't really know what this filler code was doin
cduvall 2012/03/21 18:33:49 The filler was for urls that were empty, to let th
Aaron Boodman 2012/03/21 21:26:15 I don't think that we should call this for extensi
cduvall 2012/03/21 22:00:14 Done.
38 url.title,
39 url.url);
39 pages_value->Append(page_value); 40 pages_value->Append(page_value);
40 continue;
41 } 41 }
42
43 NewTabUI::SetURLTitleAndDirection(page_value,
44 url.title,
45 url.url);
46
47 pages_value->Append(page_value);
48 } 42 }
49 // End copied code. ----------------------------------------------------------
50 43
51 result_.reset(pages_value.release()); 44 result_.reset(pages_value.release());
52 SendResponse(true); 45 SendResponse(true);
53 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698