18a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block/*
28a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * Copyright (C) 2010 Google Inc. All rights reserved.
38a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *
48a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * Redistribution and use in source and binary forms, with or without
58a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * modification, are permitted provided that the following conditions are
68a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * met:
78a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *
88a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *     * Redistributions of source code must retain the above copyright
98a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * notice, this list of conditions and the following disclaimer.
108a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *     * Redistributions in binary form must reproduce the above
118a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * copyright notice, this list of conditions and the following disclaimer
128a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * in the documentation and/or other materials provided with the
138a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * distribution.
148a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *     * Neither the name of Google Inc. nor the names of its
158a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * contributors may be used to endorse or promote products derived from
168a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * this software without specific prior written permission.
178a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *
188a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
198a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
208a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
218a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
228a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
238a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
248a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
258a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
268a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
278a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
288a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
298a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block */
308a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block
3168513a70bcd92384395513322f1b801e7bf9c729Steve Block#ifndef WebFileWriterClient_h
3268513a70bcd92384395513322f1b801e7bf9c729Steve Block#define WebFileWriterClient_h
3368513a70bcd92384395513322f1b801e7bf9c729Steve Block
3468513a70bcd92384395513322f1b801e7bf9c729Steve Block#include "WebCommon.h"
3568513a70bcd92384395513322f1b801e7bf9c729Steve Block#include "WebFileError.h"
3668513a70bcd92384395513322f1b801e7bf9c729Steve Block
3768513a70bcd92384395513322f1b801e7bf9c729Steve Blocknamespace WebKit {
3868513a70bcd92384395513322f1b801e7bf9c729Steve Block
3968513a70bcd92384395513322f1b801e7bf9c729Steve Blockclass WebFileWriterClient {
4068513a70bcd92384395513322f1b801e7bf9c729Steve Blockpublic:
4168513a70bcd92384395513322f1b801e7bf9c729Steve Block    // Called for each chunk of a write, to indicate progress.
4268513a70bcd92384395513322f1b801e7bf9c729Steve Block    // On the final chunk, when the write is finished, complete will be true.
4368513a70bcd92384395513322f1b801e7bf9c729Steve Block    virtual void didWrite(long long bytes, bool complete) = 0;
4468513a70bcd92384395513322f1b801e7bf9c729Steve Block
4568513a70bcd92384395513322f1b801e7bf9c729Steve Block    // Called once when the truncate completes successfully.
46bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen    virtual void didTruncate() = 0;
4768513a70bcd92384395513322f1b801e7bf9c729Steve Block
4868513a70bcd92384395513322f1b801e7bf9c729Steve Block    // Called if the write or truncate fails, or if it is cancelled before the write or truncate completes.  Completion of an operation will be signalled exactly once, either by didFail, didTruncate, or didWrite(..., true).
4968513a70bcd92384395513322f1b801e7bf9c729Steve Block    virtual void didFail(WebFileError) = 0;
5068513a70bcd92384395513322f1b801e7bf9c729Steve Block
5168513a70bcd92384395513322f1b801e7bf9c729Steve Blockprotected:
5268513a70bcd92384395513322f1b801e7bf9c729Steve Block    virtual ~WebFileWriterClient() { }
5368513a70bcd92384395513322f1b801e7bf9c729Steve Block};
5468513a70bcd92384395513322f1b801e7bf9c729Steve Block
5568513a70bcd92384395513322f1b801e7bf9c729Steve Block} // namespace WebKit
568a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block
5768513a70bcd92384395513322f1b801e7bf9c729Steve Block#endif
58