| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 parser.size_in_pixels()), | 72 parser.size_in_pixels()), |
| 73 &cancelable_task_tracker_); | 73 &cancelable_task_tracker_); |
| 74 } | 74 } |
| 75 | 75 |
| 76 std::string LargeIconSource::GetMimeType(const std::string&) const { | 76 std::string LargeIconSource::GetMimeType(const std::string&) const { |
| 77 // We need to explicitly return a mime type, otherwise if the user tries to | 77 // We need to explicitly return a mime type, otherwise if the user tries to |
| 78 // drag the image they get no extension. | 78 // drag the image they get no extension. |
| 79 return "image/png"; | 79 return "image/png"; |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool LargeIconSource::AllowCaching() const { |
| 83 return false; |
| 84 } |
| 85 |
| 82 bool LargeIconSource::ShouldReplaceExistingSource() const { | 86 bool LargeIconSource::ShouldReplaceExistingSource() const { |
| 83 // 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 |
| 84 // requests on the floor. | 88 // requests on the floor. |
| 85 return false; | 89 return false; |
| 86 } | 90 } |
| 87 | 91 |
| 88 bool LargeIconSource::ShouldServiceRequest( | 92 bool LargeIconSource::ShouldServiceRequest( |
| 89 const net::URLRequest* request) const { | 93 const net::URLRequest* request) const { |
| 90 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) | 94 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) |
| 91 return InstantIOContext::ShouldServiceRequest(request); | 95 return InstantIOContext::ShouldServiceRequest(request); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 url, size, *result.fallback_icon_style); | 128 url, size, *result.fallback_icon_style); |
| 125 #endif | 129 #endif |
| 126 | 130 |
| 127 callback.Run(base::RefCountedBytes::TakeVector(&bitmap_data)); | 131 callback.Run(base::RefCountedBytes::TakeVector(&bitmap_data)); |
| 128 } | 132 } |
| 129 | 133 |
| 130 void LargeIconSource::SendNotFoundResponse( | 134 void LargeIconSource::SendNotFoundResponse( |
| 131 const content::URLDataSource::GotDataCallback& callback) { | 135 const content::URLDataSource::GotDataCallback& callback) { |
| 132 callback.Run(nullptr); | 136 callback.Run(nullptr); |
| 133 } | 137 } |
| OLD | NEW |