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

Side by Side Diff: chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/media_galleries/fileapi/supported_image_type_validator. h" 5 #include "chrome/browser/media_galleries/fileapi/supported_image_type_validator. h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 result.reset(); 44 result.reset();
45 } 45 }
46 46
47 return result.Pass(); 47 return result.Pass();
48 } 48 }
49 49
50 class ImageDecoderDelegateAdapter : public ImageDecoder::Delegate { 50 class ImageDecoderDelegateAdapter : public ImageDecoder::Delegate {
51 public: 51 public:
52 ImageDecoderDelegateAdapter( 52 ImageDecoderDelegateAdapter(
53 scoped_ptr<std::string> data, 53 scoped_ptr<std::string> data,
54 const fileapi::CopyOrMoveFileValidator::ResultCallback& callback) 54 const storage::CopyOrMoveFileValidator::ResultCallback& callback)
55 : data_(data.Pass()), 55 : data_(data.Pass()), callback_(callback) {
56 callback_(callback) {
57 DCHECK(data_); 56 DCHECK(data_);
58 } 57 }
59 58
60 const std::string& data() { 59 const std::string& data() {
61 return *data_; 60 return *data_;
62 } 61 }
63 62
64 // ImageDecoder::Delegate methods. 63 // ImageDecoder::Delegate methods.
65 virtual void OnImageDecoded(const ImageDecoder* /*decoder*/, 64 virtual void OnImageDecoded(const ImageDecoder* /*decoder*/,
66 const SkBitmap& /*decoded_image*/) OVERRIDE { 65 const SkBitmap& /*decoded_image*/) OVERRIDE {
67 callback_.Run(base::File::FILE_OK); 66 callback_.Run(base::File::FILE_OK);
68 delete this; 67 delete this;
69 } 68 }
70 69
71 virtual void OnDecodeImageFailed(const ImageDecoder* /*decoder*/) OVERRIDE { 70 virtual void OnDecodeImageFailed(const ImageDecoder* /*decoder*/) OVERRIDE {
72 callback_.Run(base::File::FILE_ERROR_SECURITY); 71 callback_.Run(base::File::FILE_ERROR_SECURITY);
73 delete this; 72 delete this;
74 } 73 }
75 74
76 private: 75 private:
77 scoped_ptr<std::string> data_; 76 scoped_ptr<std::string> data_;
78 fileapi::CopyOrMoveFileValidator::ResultCallback callback_; 77 storage::CopyOrMoveFileValidator::ResultCallback callback_;
79 78
80 DISALLOW_COPY_AND_ASSIGN(ImageDecoderDelegateAdapter); 79 DISALLOW_COPY_AND_ASSIGN(ImageDecoderDelegateAdapter);
81 }; 80 };
82 81
83 } // namespace 82 } // namespace
84 83
85 SupportedImageTypeValidator::~SupportedImageTypeValidator() {} 84 SupportedImageTypeValidator::~SupportedImageTypeValidator() {}
86 85
87 // static 86 // static
88 bool SupportedImageTypeValidator::SupportsFileType(const base::FilePath& path) { 87 bool SupportedImageTypeValidator::SupportsFileType(const base::FilePath& path) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 125 }
127 126
128 // |adapter| will delete itself after a completion message is received. 127 // |adapter| will delete itself after a completion message is received.
129 ImageDecoderDelegateAdapter* adapter = 128 ImageDecoderDelegateAdapter* adapter =
130 new ImageDecoderDelegateAdapter(data.Pass(), callback_); 129 new ImageDecoderDelegateAdapter(data.Pass(), callback_);
131 decoder_ = new ImageDecoder(adapter, adapter->data(), 130 decoder_ = new ImageDecoder(adapter, adapter->data(),
132 ImageDecoder::DEFAULT_CODEC); 131 ImageDecoder::DEFAULT_CODEC);
133 decoder_->Start(content::BrowserThread::GetMessageLoopProxyForThread( 132 decoder_->Start(content::BrowserThread::GetMessageLoopProxyForThread(
134 BrowserThread::IO)); 133 BrowserThread::IO));
135 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698