summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/top_sites/top_sites_api.h
blob: 21440a100becdecde83f7da911713aaea1135075 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 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.

#ifndef CHROME_BROWSER_EXTENSIONS_API_TOP_SITES_TOP_SITES_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_TOP_SITES_TOP_SITES_API_H_

#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/history/history_types.h"

namespace extensions {

class TopSitesGetFunction : public ChromeAsyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("topSites.get", TOPSITES_GET)

  TopSitesGetFunction();

 protected:
  virtual ~TopSitesGetFunction();

  // ExtensionFunction:
  virtual bool RunAsync() OVERRIDE;

 private:
  void OnMostVisitedURLsAvailable(const history::MostVisitedURLList& data);

  // For callbacks may be run after destruction.
  base::WeakPtrFactory<TopSitesGetFunction> weak_ptr_factory_;
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_TOP_SITES_TOP_SITES_API_H_