OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/favicon/favicon_client_impl.h" | 5 #include "ios/chrome/browser/favicon/favicon_client_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/task/cancelable_task_tracker.h" | 9 #include "base/task/cancelable_task_tracker.h" |
10 #include "ios/chrome/browser/chrome_url_constants.h" | 10 #include "ios/chrome/browser/chrome_url_constants.h" |
11 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 11 #include "ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 #if !defined(__has_feature) || !__has_feature(objc_arc) | 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
15 #error "This file requires ARC support." | 15 #error "This file requires ARC support." |
16 #endif | 16 #endif |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 void RunFaviconCallbackIfNotCanceled( | 20 void RunFaviconCallbackIfNotCanceled( |
21 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled_cb, | 21 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled_cb, |
(...skipping 20 matching lines...) Expand all Loading... |
42 const GURL& url, | 42 const GURL& url, |
43 const std::vector<int>& desired_sizes_in_pixel, | 43 const std::vector<int>& desired_sizes_in_pixel, |
44 const favicon_base::FaviconResultsCallback& callback, | 44 const favicon_base::FaviconResultsCallback& callback, |
45 base::CancelableTaskTracker* tracker) { | 45 base::CancelableTaskTracker* tracker) { |
46 DCHECK(tracker); | 46 DCHECK(tracker); |
47 DCHECK(IsNativeApplicationURL(url)); | 47 DCHECK(IsNativeApplicationURL(url)); |
48 base::CancelableTaskTracker::IsCanceledCallback is_canceled_cb; | 48 base::CancelableTaskTracker::IsCanceledCallback is_canceled_cb; |
49 base::CancelableTaskTracker::TaskId task_id = | 49 base::CancelableTaskTracker::TaskId task_id = |
50 tracker->NewTrackedTaskId(&is_canceled_cb); | 50 tracker->NewTrackedTaskId(&is_canceled_cb); |
51 if (task_id != base::CancelableTaskTracker::kBadTaskId) { | 51 if (task_id != base::CancelableTaskTracker::kBadTaskId) { |
52 ios::GetChromeBrowserProvider()->GetFaviconForURL( | 52 ChromeWebUIIOSControllerFactory::GetInstance()->GetFaviconForURL( |
53 browser_state_, url, desired_sizes_in_pixel, | 53 browser_state_, url, desired_sizes_in_pixel, |
54 base::Bind(&RunFaviconCallbackIfNotCanceled, is_canceled_cb, callback)); | 54 base::Bind(&RunFaviconCallbackIfNotCanceled, is_canceled_cb, callback)); |
55 } | 55 } |
56 return task_id; | 56 return task_id; |
57 } | 57 } |
OLD | NEW |