Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_IMAGE_LOADING_HELPER_H_ | |
| 6 #define CONTENT_RENDERER_IMAGE_LOADING_HELPER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/memory/scoped_vector.h" | |
| 12 #include "content/public/renderer/render_view_observer.h" | |
| 13 #include "googleurl/src/gurl.h" | |
| 14 | |
| 15 class SkBitmap; | |
| 16 | |
| 17 namespace webkit_glue { | |
| 18 class MultiResolutionImageResourceFetcher; | |
| 19 } | |
| 20 | |
| 21 namespace content { | |
| 22 | |
| 23 // This class deals with favicon downloading. | |
|
brettw
2013/03/20 23:25:56
Is this comment still up-to-date?
Dmitry Titov
2013/03/27 22:41:13
Done.
| |
| 24 // One instance of ImageLoadingHelper is owned by RenderView. | |
| 25 class ImageLoadingHelper : public RenderViewObserver { | |
| 26 public: | |
| 27 explicit ImageLoadingHelper(RenderView* render_view); | |
| 28 | |
| 29 private: | |
| 30 virtual ~ImageLoadingHelper(); | |
| 31 | |
| 32 // Message handler. | |
| 33 void OnDownloadImage(int id, const GURL& image_url, int image_size); | |
| 34 | |
| 35 // Requests to download an image. When done, the ImageLoadingHelper | |
| 36 // is notified by way of DidDownloadImage. Returns true if the | |
| 37 // request was successfully started, false otherwise. id is used to | |
| 38 // uniquely identify the request and passed back to the | |
| 39 // DidDownloadImage method. If the image has multiple frames, the | |
| 40 // frame whose size is image_size is returned. If the image doesn't | |
| 41 // have a frame at the specified size, the first is returned. | |
| 42 bool DownloadImage(int id, const GURL& image_url, int image_size); | |
| 43 | |
| 44 // This callback is triggered when DownloadImage completes, either | |
| 45 // succesfully or with a failure. See DownloadImage for more | |
| 46 // details. | |
| 47 void DidDownloadImage( | |
| 48 int requested_size, | |
| 49 webkit_glue::MultiResolutionImageResourceFetcher* fetcher, | |
| 50 const std::vector<SkBitmap>& images); | |
| 51 | |
| 52 // Decodes a data: URL image or returns an empty image in case of failure. | |
| 53 SkBitmap ImageFromDataUrl(const GURL&) const; | |
| 54 | |
| 55 // RenderViewObserver implementation. | |
| 56 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 57 | |
| 58 typedef ScopedVector<webkit_glue::MultiResolutionImageResourceFetcher> | |
| 59 ImageResourceFetcherList; | |
|
brettw
2013/03/20 23:25:56
4 space-indents for wrapped lines.
Dmitry Titov
2013/03/27 22:41:13
Done.
| |
| 60 | |
| 61 // ImageResourceFetchers schedule via DownloadImage. | |
| 62 ImageResourceFetcherList image_fetchers_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(ImageLoadingHelper); | |
| 65 }; | |
| 66 | |
| 67 } // namespace content | |
|
brettw
2013/03/20 23:25:56
2 spaces before //
Dmitry Titov
2013/03/27 22:41:13
Done.
| |
| 68 | |
| 69 #endif // CONTENT_RENDERER_IMAGE_LOADING_HELPER_H_ | |
| 70 | |
| OLD | NEW |