| 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 "chrome/browser/ui/webui/large_icon_source.h" | 5 #include "chrome/browser/ui/webui/large_icon_source.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "chrome/browser/search/instant_io_context.h" | 10 #include "chrome/browser/search/instant_io_context.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return false; | 83 return false; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool LargeIconSource::ShouldReplaceExistingSource() const { | 86 bool LargeIconSource::ShouldReplaceExistingSource() const { |
| 87 // Leave the existing DataSource in place, otherwise we'll drop any pending | 87 // Leave the existing DataSource in place, otherwise we'll drop any pending |
| 88 // requests on the floor. | 88 // requests on the floor. |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool LargeIconSource::ShouldServiceRequest( | 92 bool LargeIconSource::ShouldServiceRequest( |
| 93 const net::URLRequest* request) const { | 93 const GURL& url, |
| 94 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) | 94 content::ResourceContext* resource_context, |
| 95 return InstantIOContext::ShouldServiceRequest(request); | 95 int render_process_id) const { |
| 96 return URLDataSource::ShouldServiceRequest(request); | 96 if (url.SchemeIs(chrome::kChromeSearchScheme)) { |
| 97 return InstantIOContext::ShouldServiceRequest(url, resource_context, |
| 98 render_process_id); |
| 99 } |
| 100 return URLDataSource::ShouldServiceRequest(url, resource_context, |
| 101 render_process_id); |
| 97 } | 102 } |
| 98 | 103 |
| 99 void LargeIconSource::OnLargeIconDataAvailable( | 104 void LargeIconSource::OnLargeIconDataAvailable( |
| 100 const content::URLDataSource::GotDataCallback& callback, | 105 const content::URLDataSource::GotDataCallback& callback, |
| 101 const GURL& url, | 106 const GURL& url, |
| 102 int size, | 107 int size, |
| 103 const favicon_base::LargeIconResult& result) { | 108 const favicon_base::LargeIconResult& result) { |
| 104 if (result.bitmap.is_valid()) { | 109 if (result.bitmap.is_valid()) { |
| 105 callback.Run(result.bitmap.bitmap_data.get()); | 110 callback.Run(result.bitmap.bitmap_data.get()); |
| 106 return; | 111 return; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 128 url, size, *result.fallback_icon_style); | 133 url, size, *result.fallback_icon_style); |
| 129 #endif | 134 #endif |
| 130 | 135 |
| 131 callback.Run(base::RefCountedBytes::TakeVector(&bitmap_data)); | 136 callback.Run(base::RefCountedBytes::TakeVector(&bitmap_data)); |
| 132 } | 137 } |
| 133 | 138 |
| 134 void LargeIconSource::SendNotFoundResponse( | 139 void LargeIconSource::SendNotFoundResponse( |
| 135 const content::URLDataSource::GotDataCallback& callback) { | 140 const content::URLDataSource::GotDataCallback& callback) { |
| 136 callback.Run(nullptr); | 141 callback.Run(nullptr); |
| 137 } | 142 } |
| OLD | NEW |