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

Unified Diff: chrome/browser/history/top_sites_extension_api.cc

Issue 11522007: Move TopSites api from c/b/history to c/b/e/api (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_ungoop_history
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/top_sites_extension_api.cc
diff --git a/chrome/browser/history/top_sites_extension_api.cc b/chrome/browser/history/top_sites_extension_api.cc
deleted file mode 100644
index 4bcaa5b1e6458725f668e14637d3e8f73b9a5358..0000000000000000000000000000000000000000
--- a/chrome/browser/history/top_sites_extension_api.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/history/top_sites_extension_api.h"
-
-#include "base/bind.h"
-#include "base/values.h"
-#include "chrome/browser/history/top_sites.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
-
-GetTopSitesFunction::GetTopSitesFunction()
- : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {}
-
-GetTopSitesFunction::~GetTopSitesFunction() {}
-
-bool GetTopSitesFunction::RunImpl() {
- history::TopSites* ts = profile()->GetTopSites();
- if (!ts)
- return false;
-
- ts->GetMostVisitedURLs(
- base::Bind(&GetTopSitesFunction::OnMostVisitedURLsAvailable,
- weak_ptr_factory_.GetWeakPtr()));
- return true;
-}
-
-void GetTopSitesFunction::OnMostVisitedURLsAvailable(
- const history::MostVisitedURLList& data) {
- scoped_ptr<base::ListValue> pages_value(new ListValue);
- for (size_t i = 0; i < data.size(); i++) {
- const history::MostVisitedURL& url = data[i];
- if (!url.url.is_empty()) {
- DictionaryValue* page_value = new DictionaryValue();
- page_value->SetString("url", url.url.spec());
- if (url.title.empty())
- page_value->SetString("title", url.url.spec());
- else
- page_value->SetString("title", url.title);
- pages_value->Append(page_value);
- }
- }
-
- SetResult(pages_value.release());
- SendResponse(true);
-}
« no previous file with comments | « chrome/browser/history/top_sites_extension_api.h ('k') | chrome/browser/history/top_sites_extension_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698