OLD | NEW |
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/history/top_sites_extension_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 { |
| 14 |
13 GetTopSitesFunction::GetTopSitesFunction() | 15 GetTopSitesFunction::GetTopSitesFunction() |
14 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {} | 16 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {} |
15 | 17 |
16 GetTopSitesFunction::~GetTopSitesFunction() {} | 18 GetTopSitesFunction::~GetTopSitesFunction() {} |
17 | 19 |
18 bool GetTopSitesFunction::RunImpl() { | 20 bool GetTopSitesFunction::RunImpl() { |
19 history::TopSites* ts = profile()->GetTopSites(); | 21 history::TopSites* ts = profile()->GetTopSites(); |
20 if (!ts) | 22 if (!ts) |
21 return false; | 23 return false; |
22 | 24 |
(...skipping 15 matching lines...) Expand all Loading... |
38 page_value->SetString("title", url.url.spec()); | 40 page_value->SetString("title", url.url.spec()); |
39 else | 41 else |
40 page_value->SetString("title", url.title); | 42 page_value->SetString("title", url.title); |
41 pages_value->Append(page_value); | 43 pages_value->Append(page_value); |
42 } | 44 } |
43 } | 45 } |
44 | 46 |
45 SetResult(pages_value.release()); | 47 SetResult(pages_value.release()); |
46 SendResponse(true); | 48 SendResponse(true); |
47 } | 49 } |
| 50 |
| 51 } // namespace extensions |
OLD | NEW |