| Index: chrome/browser/android/webapk/webapk_installer.cc
|
| diff --git a/chrome/browser/android/webapk/webapk_installer.cc b/chrome/browser/android/webapk/webapk_installer.cc
|
| index ba03aeafc78163deac95fea00b5de1510f343d9e..24eed04e9777193377edfda332814954de388897 100644
|
| --- a/chrome/browser/android/webapk/webapk_installer.cc
|
| +++ b/chrome/browser/android/webapk/webapk_installer.cc
|
| @@ -13,6 +13,7 @@
|
| #include "base/files/file_path.h"
|
| #include "base/files/file_util.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/metrics/field_trial.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| @@ -34,6 +35,9 @@
|
|
|
| namespace {
|
|
|
| +// Flag for setting the WebAPK server URL.
|
| +const char kWebApkServerFinchFlag[] = "WebApkServerUrl";
|
| +
|
| // The default WebAPK server URL.
|
| const char kDefaultWebApkServerUrl[] =
|
| "https://webapk.googleapis.com/v1alpha/webApks/";
|
| @@ -125,6 +129,17 @@ scoped_refptr<base::TaskRunner> GetBackgroundTaskRunner() {
|
| base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
|
| }
|
|
|
| +GURL GetBaseServerUrl() {
|
| + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
| + if (command_line->HasSwitch(switches::kWebApkServerUrl))
|
| + return GURL(command_line->GetSwitchValueASCII(switches::kWebApkServerUrl));
|
| + std::string server_url =
|
| + base::FieldTrialList::FindFullName(kWebApkServerFinchFlag);
|
| + if (!server_url.empty())
|
| + return GURL(server_url);
|
| + return GURL(kDefaultWebApkServerUrl);
|
| +}
|
| +
|
| GURL GetServerUrlForUpdate(const GURL& server_url,
|
| const std::string& webapk_package) {
|
| // crbug.com/636552. Simplify the server URL.
|
| @@ -170,15 +185,11 @@ WebApkInstaller::WebApkInstaller(const ShortcutInfo& shortcut_info,
|
| const SkBitmap& shortcut_icon)
|
| : shortcut_info_(shortcut_info),
|
| shortcut_icon_(shortcut_icon),
|
| + server_url_(GetBaseServerUrl()),
|
| webapk_download_url_timeout_ms_(kWebApkDownloadUrlTimeoutMs),
|
| download_timeout_ms_(kDownloadTimeoutMs),
|
| task_type_(UNDEFINED),
|
| weak_ptr_factory_(this) {
|
| - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
| - server_url_ =
|
| - GURL(command_line->HasSwitch(switches::kWebApkServerUrl)
|
| - ? command_line->GetSwitchValueASCII(switches::kWebApkServerUrl)
|
| - : kDefaultWebApkServerUrl);
|
| CreateJavaRef();
|
| }
|
|
|
|
|