| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_TOP_SITES_TOP_SITES_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TOP_SITES_TOP_SITES_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_TOP_SITES_TOP_SITES_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_TOP_SITES_TOP_SITES_API_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/extensions/chrome_extension_function.h" | 9 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 10 #include "components/history/core/browser/history_types.h" | 10 #include "components/history/core/browser/history_types.h" |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 | 13 |
| 14 class TopSitesGetFunction : public ChromeAsyncExtensionFunction { | 14 class TopSitesGetFunction : public ChromeAsyncExtensionFunction { |
| 15 public: | 15 public: |
| 16 DECLARE_EXTENSION_FUNCTION("topSites.get", TOPSITES_GET) | 16 DECLARE_EXTENSION_FUNCTION("topSites.get", TOPSITES_GET) |
| 17 | 17 |
| 18 TopSitesGetFunction(); | 18 TopSitesGetFunction(); |
| 19 | 19 |
| 20 protected: | 20 protected: |
| 21 virtual ~TopSitesGetFunction(); | 21 virtual ~TopSitesGetFunction(); |
| 22 | 22 |
| 23 // ExtensionFunction: | 23 // ExtensionFunction: |
| 24 virtual bool RunAsync() OVERRIDE; | 24 virtual bool RunAsync() override; |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 void OnMostVisitedURLsAvailable(const history::MostVisitedURLList& data); | 27 void OnMostVisitedURLsAvailable(const history::MostVisitedURLList& data); |
| 28 | 28 |
| 29 // For callbacks may be run after destruction. | 29 // For callbacks may be run after destruction. |
| 30 base::WeakPtrFactory<TopSitesGetFunction> weak_ptr_factory_; | 30 base::WeakPtrFactory<TopSitesGetFunction> weak_ptr_factory_; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 } // namespace extensions | 33 } // namespace extensions |
| 34 | 34 |
| 35 #endif // CHROME_BROWSER_EXTENSIONS_API_TOP_SITES_TOP_SITES_API_H_ | 35 #endif // CHROME_BROWSER_EXTENSIONS_API_TOP_SITES_TOP_SITES_API_H_ |
| OLD | NEW |