OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/search/thumbnail_source.h" | 5 #include "chrome/browser/search/thumbnail_source.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include "base/callback.h" | 9 #include "base/callback.h" |
8 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
9 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/search/instant_io_context.h" | 13 #include "chrome/browser/search/instant_io_context.h" |
12 #include "chrome/browser/search/suggestions/image_fetcher_impl.h" | 14 #include "chrome/browser/search/suggestions/image_fetcher_impl.h" |
13 #include "chrome/browser/thumbnails/thumbnail_service.h" | 15 #include "chrome/browser/thumbnails/thumbnail_service.h" |
14 #include "chrome/browser/thumbnails/thumbnail_service_factory.h" | 16 #include "chrome/browser/thumbnails/thumbnail_service_factory.h" |
15 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
16 #include "components/suggestions/image_encoder.h" | 18 #include "components/suggestions/image_encoder.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 119 |
118 scoped_refptr<base::RefCountedBytes> encoded_data( | 120 scoped_refptr<base::RefCountedBytes> encoded_data( |
119 new base::RefCountedBytes()); | 121 new base::RefCountedBytes()); |
120 if (!suggestions::EncodeSkBitmapToJPEG(*bitmap, &encoded_data->data())) { | 122 if (!suggestions::EncodeSkBitmapToJPEG(*bitmap, &encoded_data->data())) { |
121 callback.Run(default_thumbnail_.get()); | 123 callback.Run(default_thumbnail_.get()); |
122 return; | 124 return; |
123 } | 125 } |
124 | 126 |
125 callback.Run(encoded_data.get()); | 127 callback.Run(encoded_data.get()); |
126 } | 128 } |
OLD | NEW |