forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request flutter#1109 from mpcomplete/version.check
Compare versions before updating an app bundle.
- Loading branch information
Showing
9 changed files
with
342 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// 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. | ||
|
||
#include "sky/shell/updater/manifest.h" | ||
|
||
#include "base/strings/string_split.h" | ||
#include "base/strings/string_util.h" | ||
|
||
namespace sky { | ||
namespace shell { | ||
|
||
// static | ||
scoped_ptr<Manifest> Manifest::Parse(const std::string& manifest_data) { | ||
scoped_ptr<Manifest> manifest(new Manifest); | ||
|
||
// Poor man's YAML parsing. | ||
// TODO(mpcomplete): use an actual YAML parser. | ||
base::StringPairs key_values; | ||
base::SplitStringIntoKeyValuePairs(manifest_data, ':', '\n', &key_values); | ||
for (const auto& key_value : key_values) { | ||
auto value = base::TrimWhitespaceASCII(key_value.second, base::TRIM_ALL); | ||
if (key_value.first == "update_url") { | ||
manifest->update_url_ = GURL(value.as_string()); | ||
} else if (key_value.first == "version") { | ||
manifest->version_ = base::Version(value.as_string()); | ||
} | ||
} | ||
return manifest; | ||
} | ||
|
||
} // namespace shell | ||
} // namespace sky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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_MANIFEST_H_ | ||
#define SKY_SHELL_MANIFEST_H_ | ||
|
||
#include <string> | ||
|
||
#include "base/memory/scoped_ptr.h" | ||
#include "base/version.h" | ||
#include "url/gurl.h" | ||
|
||
namespace sky { | ||
namespace shell { | ||
|
||
struct Manifest { | ||
public: | ||
static scoped_ptr<Manifest> Parse(const std::string& manifest_data); | ||
|
||
bool IsValid() const { return version_.IsValid(); } | ||
|
||
const GURL& update_url() const { return update_url_; } | ||
const base::Version& version() const { return version_; } | ||
|
||
private: | ||
GURL update_url_; | ||
base::Version version_; | ||
}; | ||
|
||
} // namespace shell | ||
} // namespace sky | ||
|
||
#endif // SKY_SHELL_MANIFEST_H_ |
Oops, something went wrong.