| 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/extensions/api/top_sites/top_sites_api.h" | 5 #include "chrome/browser/extensions/api/top_sites/top_sites_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> |
| 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/values.h" | 12 #include "base/values.h" |
| 11 #include "chrome/browser/history/top_sites_factory.h" | 13 #include "chrome/browser/history/top_sites_factory.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 15 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 14 #include "components/history/core/browser/top_sites.h" | 16 #include "components/history/core/browser/top_sites.h" |
| 15 | 17 |
| 16 namespace extensions { | 18 namespace extensions { |
| 17 | 19 |
| 18 TopSitesGetFunction::TopSitesGetFunction() | 20 TopSitesGetFunction::TopSitesGetFunction() |
| (...skipping 22 matching lines...) Expand all Loading... |
| 41 base::DictionaryValue* page_value = new base::DictionaryValue(); | 43 base::DictionaryValue* page_value = new base::DictionaryValue(); |
| 42 page_value->SetString("url", url.url.spec()); | 44 page_value->SetString("url", url.url.spec()); |
| 43 if (url.title.empty()) | 45 if (url.title.empty()) |
| 44 page_value->SetString("title", url.url.spec()); | 46 page_value->SetString("title", url.url.spec()); |
| 45 else | 47 else |
| 46 page_value->SetString("title", url.title); | 48 page_value->SetString("title", url.title); |
| 47 pages_value->Append(page_value); | 49 pages_value->Append(page_value); |
| 48 } | 50 } |
| 49 } | 51 } |
| 50 | 52 |
| 51 SetResult(pages_value.release()); | 53 SetResult(std::move(pages_value)); |
| 52 SendResponse(true); | 54 SendResponse(true); |
| 53 } | 55 } |
| 54 | 56 |
| 55 } // namespace extensions | 57 } // namespace extensions |
| OLD | NEW |