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

Side by Side Diff: chrome/browser/extensions/api/top_sites/top_sites_api.cc

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/api/top_sites/top_sites_api.h" 5 #include "chrome/browser/extensions/api/top_sites/top_sites_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"
11 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 11 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 TopSitesGetFunction::TopSitesGetFunction() 15 TopSitesGetFunction::TopSitesGetFunction()
16 : weak_ptr_factory_(this) {} 16 : weak_ptr_factory_(this) {}
17 17
18 TopSitesGetFunction::~TopSitesGetFunction() {} 18 TopSitesGetFunction::~TopSitesGetFunction() {}
19 19
20 bool TopSitesGetFunction::RunImpl() { 20 bool TopSitesGetFunction::RunAsync() {
21 history::TopSites* ts = GetProfile()->GetTopSites(); 21 history::TopSites* ts = GetProfile()->GetTopSites();
22 if (!ts) 22 if (!ts)
23 return false; 23 return false;
24 24
25 ts->GetMostVisitedURLs( 25 ts->GetMostVisitedURLs(
26 base::Bind(&TopSitesGetFunction::OnMostVisitedURLsAvailable, 26 base::Bind(&TopSitesGetFunction::OnMostVisitedURLsAvailable,
27 weak_ptr_factory_.GetWeakPtr()), false); 27 weak_ptr_factory_.GetWeakPtr()), false);
28 return true; 28 return true;
29 } 29 }
30 30
(...skipping 11 matching lines...) Expand all
42 page_value->SetString("title", url.title); 42 page_value->SetString("title", url.title);
43 pages_value->Append(page_value); 43 pages_value->Append(page_value);
44 } 44 }
45 } 45 }
46 46
47 SetResult(pages_value.release()); 47 SetResult(pages_value.release());
48 SendResponse(true); 48 SendResponse(true);
49 } 49 }
50 50
51 } // namespace extensions 51 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/top_sites/top_sites_api.h ('k') | chrome/browser/extensions/api/web_request/web_request_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698