Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1502)

Unified Diff: chrome/browser/android/webapk/webapk_installer.cc

Issue 2380053003: Add Finch flag for the WebAPK server URL (Closed)
Patch Set: Merge branch 'master' into webapk_server_url Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698