flutter_flutter/sky/shell/android/update_service_android.h
Matt Perry d05b9480e6 Introduce an UpdateService for android.
Very simple so far. This schedules an alarm to fire once a day, kicking
off a service that downloads a new app.skyx from a hardcoded URL. The
new skyx replaces the current one.
2015-09-02 15:32:09 -04:00

42 lines
1.1 KiB
C++

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_UPDATE_SERVICE_H_
#define SKY_SHELL_UPDATE_SERVICE_H_
#include <jni.h>
#include "base/android/jni_string.h"
#include "base/files/file_path.h"
#include "mojo/services/network/public/interfaces/network_service.mojom.h"
namespace sky {
namespace shell {
class UpdateTask {
public:
UpdateTask(JNIEnv* env, jobject update_service, std::string data_dir);
void DownloadAppBundle(const std::string& url);
void Detach(JNIEnv* env, jobject jcaller);
private:
void OnResponse(mojo::URLResponsePtr response);
void OnCopied(bool success);
void CallOnFinished();
base::android::ScopedJavaGlobalRef<jobject> update_service_;
mojo::NetworkServicePtr network_service_;
base::FilePath temp_path_;
base::FilePath final_path_;
mojo::URLLoaderPtr url_loader_;
};
bool RegisterUpdateService(JNIEnv* env);
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_UPDATE_SERVICE_H_