OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SKY_ENGINE_CORE_LOADER_NEWIMAGELOADER_H_ |
| 6 #define SKY_ENGINE_CORE_LOADER_NEWIMAGELOADER_H_ |
| 7 |
| 8 #include "mojo/common/data_pipe_drainer.h" |
| 9 #include "sky/engine/platform/SharedBuffer.h" |
| 10 #include "sky/engine/platform/fetcher/MojoFetcher.h" |
| 11 #include "sky/engine/wtf/OwnPtr.h" |
| 12 #include "sky/engine/wtf/text/AtomicString.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class NewImageLoaderClient { |
| 18 public: |
| 19 virtual void OnLoadFinished(const SkBitmap& result) = 0; |
| 20 |
| 21 protected: |
| 22 NewImageLoaderClient() {} |
| 23 }; |
| 24 |
| 25 class NewImageLoader : public MojoFetcher::Client, |
| 26 public mojo::common::DataPipeDrainer::Client { |
| 27 public: |
| 28 explicit NewImageLoader(NewImageLoaderClient* client); |
| 29 virtual ~NewImageLoader(); |
| 30 |
| 31 void Load(const KURL& src); |
| 32 |
| 33 // MojoFetcher::Client |
| 34 void OnReceivedResponse(mojo::URLResponsePtr) override; |
| 35 |
| 36 // mojo::common::DataPipeDrainer::Client |
| 37 void OnDataAvailable(const void*, size_t) override; |
| 38 void OnDataComplete() override; |
| 39 |
| 40 private: |
| 41 NewImageLoaderClient* client_; |
| 42 OwnPtr<MojoFetcher> fetcher_; |
| 43 OwnPtr<mojo::common::DataPipeDrainer> drainer_; |
| 44 RefPtr<SharedBuffer> buffer_; |
| 45 }; |
| 46 |
| 47 } // namespace blink |
| 48 |
| 49 #endif // SKY_ENGINE_CORE_LOADER_NEWIMAGELOADER_H_ |
OLD | NEW |