| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #error "This file requires ARC support." | 25 #error "This file requires ARC support." |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 int GetFaviconResourceIdForNativeURL(const GURL& url) { | 30 int GetFaviconResourceIdForNativeURL(const GURL& url) { |
| 31 if (url.host_piece() == kChromeUICrashesHost) | 31 if (url.host_piece() == kChromeUICrashesHost) |
| 32 return IDR_CRASH_SAD_FAVICON; | 32 return IDR_CRASH_SAD_FAVICON; |
| 33 if (url.host_piece() == kChromeUIFlagsHost) | 33 if (url.host_piece() == kChromeUIFlagsHost) |
| 34 return IDR_FLAGS_FAVICON; | 34 return IDR_FLAGS_FAVICON; |
| 35 if (url.host_piece() == kChromeUIAppleFlagsHost) | |
| 36 return IDR_FLAGS_FAVICON; | |
| 37 return -1; | 35 return -1; |
| 38 } | 36 } |
| 39 | 37 |
| 40 void GetFaviconBitmapForNativeURL( | 38 void GetFaviconBitmapForNativeURL( |
| 41 const GURL& url, | 39 const GURL& url, |
| 42 const std::vector<int>& desired_sizes_in_pixel, | 40 const std::vector<int>& desired_sizes_in_pixel, |
| 43 std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results) { | 41 std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results) { |
| 44 const int resource_id = GetFaviconResourceIdForNativeURL(url); | 42 const int resource_id = GetFaviconResourceIdForNativeURL(url); |
| 45 if (resource_id == -1) | 43 if (resource_id == -1) |
| 46 return; | 44 return; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 auto favicon_bitmap_results = | 96 auto favicon_bitmap_results = |
| 99 base::MakeUnique<std::vector<favicon_base::FaviconRawBitmapResult>>(); | 97 base::MakeUnique<std::vector<favicon_base::FaviconRawBitmapResult>>(); |
| 100 GetFaviconBitmapForNativeURL(url, desired_sizes_in_pixel, | 98 GetFaviconBitmapForNativeURL(url, desired_sizes_in_pixel, |
| 101 favicon_bitmap_results.get()); | 99 favicon_bitmap_results.get()); |
| 102 | 100 |
| 103 return tracker->PostTask( | 101 return tracker->PostTask( |
| 104 base::ThreadTaskRunnerHandle::Get().get(), FROM_HERE, | 102 base::ThreadTaskRunnerHandle::Get().get(), FROM_HERE, |
| 105 base::Bind(&favicon::FaviconService::FaviconResultsCallbackRunner, | 103 base::Bind(&favicon::FaviconService::FaviconResultsCallbackRunner, |
| 106 callback, base::Owned(favicon_bitmap_results.release()))); | 104 callback, base::Owned(favicon_bitmap_results.release()))); |
| 107 } | 105 } |
| OLD | NEW |