Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: webkit/glue/multi_resolution_image_resource_fetcher.cc

Issue 10853010: Add webkit/ api to request all frames in an image. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/multi_resolution_image_resource_fetcher.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/multi_resolution_image_resource_fetcher.cc
diff --git a/webkit/glue/image_resource_fetcher.cc b/webkit/glue/multi_resolution_image_resource_fetcher.cc
similarity index 70%
copy from webkit/glue/image_resource_fetcher.cc
copy to webkit/glue/multi_resolution_image_resource_fetcher.cc
index 54d141350ac9eadf2f3eccc9239e04c29d3080cd..1fa67ae794c43c77e3d9935bc27888225e4594e0 100644
--- a/webkit/glue/image_resource_fetcher.cc
+++ b/webkit/glue/multi_resolution_image_resource_fetcher.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/glue/image_resource_fetcher.h"
+#include "webkit/glue/multi_resolution_image_resource_fetcher.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -17,46 +17,42 @@ using WebKit::WebURLResponse;
namespace webkit_glue {
-ImageResourceFetcher::ImageResourceFetcher(
+MultiResolutionImageResourceFetcher::MultiResolutionImageResourceFetcher(
const GURL& image_url,
WebFrame* frame,
int id,
- int image_size,
WebURLRequest::TargetType target_type,
const Callback& callback)
: callback_(callback),
id_(id),
- image_url_(image_url),
- image_size_(image_size) {
+ image_url_(image_url) {
fetcher_.reset(new ResourceFetcher(
image_url, frame, target_type,
- base::Bind(&ImageResourceFetcher::OnURLFetchComplete,
+ base::Bind(&MultiResolutionImageResourceFetcher::OnURLFetchComplete,
base::Unretained(this))));
}
-ImageResourceFetcher::~ImageResourceFetcher() {
+MultiResolutionImageResourceFetcher::~MultiResolutionImageResourceFetcher() {
if (!fetcher_->completed())
fetcher_->Cancel();
}
-void ImageResourceFetcher::OnURLFetchComplete(
+void MultiResolutionImageResourceFetcher::OnURLFetchComplete(
const WebURLResponse& response,
const std::string& data) {
- SkBitmap bitmap;
+ std::vector<SkBitmap> bitmaps;
if (!response.isNull() && response.httpStatusCode() == 200) {
// Request succeeded, try to convert it to an image.
- ImageDecoder decoder(gfx::Size(image_size_, image_size_));
- bitmap = decoder.Decode(
+ bitmaps = ImageDecoder::DecodeAll(
reinterpret_cast<const unsigned char*>(data.data()), data.size());
} // else case:
// If we get here, it means no image from server or couldn't decode the
- // response as an image. The delegate will see a null image, indicating
- // that an error occurred.
+ // response as an image. The delegate will see an empty vector.
// Take a reference to the callback as running the callback may lead to our
// destruction.
Callback callback = callback_;
- callback.Run(this, bitmap);
+ callback.Run(this, bitmaps);
}
} // namespace webkit_glue
« no previous file with comments | « webkit/glue/multi_resolution_image_resource_fetcher.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698