This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
refactoring chrome_installer #13122
Merged
Merged
refactoring chrome_installer #13122
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,7 @@ | ||
| chrome: | ||
| # It seems Chrome can't always release from the same build for all operating | ||
| # systems, so we specify per-OS build number. | ||
| Linux: 695653 | ||
| Mac: 695656 | ||
| firefox: | ||
| version: 69.0.3 |
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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,101 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'dart:io' as io; | ||
|
|
||
| import 'package:path/path.dart' as path; | ||
| import 'package:yaml/yaml.dart'; | ||
|
|
||
| class BrowserInstallerException implements Exception { | ||
| BrowserInstallerException(this.message); | ||
|
|
||
| final String message; | ||
|
|
||
| @override | ||
| String toString() => message; | ||
| } | ||
|
|
||
| abstract class PlatformBinding { | ||
| static PlatformBinding get instance { | ||
| if (_instance == null) { | ||
| if (io.Platform.isLinux) { | ||
| _instance = _LinuxBinding(); | ||
| } else if (io.Platform.isMacOS) { | ||
| _instance = _MacBinding(); | ||
| } else { | ||
| throw '${io.Platform.operatingSystem} is not supported'; | ||
| } | ||
| } | ||
| return _instance; | ||
| } | ||
|
|
||
| static PlatformBinding _instance; | ||
|
|
||
| int getChromeBuild(YamlMap chromeLock); | ||
| String getChromeDownloadUrl(String version); | ||
| String getFirefoxDownloadUrl(String version); | ||
| String getChromeExecutablePath(io.Directory versionDir); | ||
| String getFirefoxExecutablePath(io.Directory versionDir); | ||
| } | ||
|
|
||
| const String _kBaseDownloadUrl = | ||
| 'https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o'; | ||
|
|
||
| class _LinuxBinding implements PlatformBinding { | ||
| @override | ||
| int getChromeBuild(YamlMap browserLock) { | ||
| final YamlMap chromeMap = browserLock['chrome']; | ||
| return chromeMap['Linux']; | ||
| } | ||
|
|
||
| @override | ||
| String getChromeDownloadUrl(String version) => | ||
| '$_kBaseDownloadUrl/Linux_x64%2F$version%2Fchrome-linux.zip?alt=media'; | ||
|
|
||
| @override | ||
| String getChromeExecutablePath(io.Directory versionDir) => | ||
| path.join(versionDir.path, 'chrome-linux', 'chrome'); | ||
|
|
||
| @override | ||
| String getFirefoxDownloadUrl(String version) { | ||
|
nturgut marked this conversation as resolved.
Outdated
|
||
| // TODO: implement getFirefoxDownloadUrl | ||
| return null; | ||
| } | ||
|
|
||
| @override | ||
| String getFirefoxExecutablePath(io.Directory versionDir) { | ||
| // TODO: implement getFirefoxExecutablePath | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| class _MacBinding implements PlatformBinding { | ||
| @override | ||
| int getChromeBuild(YamlMap browserLock) => browserLock['Mac']; | ||
|
|
||
| @override | ||
| String getChromeDownloadUrl(String version) => | ||
| '$_kBaseDownloadUrl/Mac%2F$version%2Fchrome-mac.zip?alt=media'; | ||
|
|
||
| @override | ||
| String getChromeExecutablePath(io.Directory versionDir) => path.join( | ||
| versionDir.path, | ||
| 'chrome-mac', | ||
| 'Chromium.app', | ||
| 'Contents', | ||
| 'MacOS', | ||
| 'Chromium'); | ||
|
|
||
| @override | ||
| String getFirefoxDownloadUrl(String version) { | ||
| // TODO: implement getFirefoxDownloadUrl | ||
| return null; | ||
| } | ||
|
|
||
| @override | ||
| String getFirefoxExecutablePath(io.Directory versionDir) { | ||
| // TODO: implement getFirefoxExecutablePath | ||
| return null; | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.