Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / components / favicon / core / favicon_client.h
blobfaeea185e4fbadd76bb85a6331b425233d0f7ce7
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_FAVICON_CORE_FAVICON_CLIENT_H_
6 #define COMPONENTS_FAVICON_CORE_FAVICON_CLIENT_H_
8 #include <vector>
10 #include "base/macros.h"
11 #include "base/task/cancelable_task_tracker.h"
12 #include "components/favicon_base/favicon_callback.h"
13 #include "components/keyed_service/core/keyed_service.h"
15 class GURL;
17 namespace favicon {
19 // This class abstracts operations that depend on the embedder's environment,
20 // e.g. Chrome.
21 class FaviconClient : public KeyedService {
22 public:
23 // Returns true if the specified URL is a native application page URL.
24 // If this returns true the favicon for the page must be fetched using
25 // GetFaviconForNativeApplicationURL().
26 virtual bool IsNativeApplicationURL(const GURL& url) = 0;
28 // Requests the favicon for a native application page URL for the sizes
29 // specified by |desired_sizes_in_pixel|. Returns a TaskId to use to cancel
30 // the request using |tracker| or kBadTaskId if the request cannot be
31 // scheduled. |callback| will be called with the favicon results.
32 virtual base::CancelableTaskTracker::TaskId GetFaviconForNativeApplicationURL(
33 const GURL& url,
34 const std::vector<int>& desired_sizes_in_pixel,
35 const favicon_base::FaviconResultsCallback& callback,
36 base::CancelableTaskTracker* tracker) = 0;
38 protected:
39 FaviconClient() {}
40 ~FaviconClient() override {}
42 private:
43 DISALLOW_COPY_AND_ASSIGN(FaviconClient);
46 } // namespace favicon
48 #endif // COMPONENTS_FAVICON_CORE_FAVICON_CLIENT_H_