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

Side by Side Diff: content/child/runtime_features.cc

Issue 2930323003: Show client placeholders for Server LoFi images. (Closed)
Patch Set: Added field trial and command line switch controls Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/runtime_features.h" 5 #include "content/child/runtime_features.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
11 #include "base/metrics/field_trial.h" 11 #include "base/metrics/field_trial.h"
12 #include "base/metrics/field_trial_params.h"
12 #include "base/strings/string_split.h" 13 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "content/common/content_switches_internal.h" 16 #include "content/common/content_switches_internal.h"
16 #include "content/public/common/content_features.h" 17 #include "content/public/common/content_features.h"
17 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
18 #include "media/base/media_switches.h" 19 #include "media/base/media_switches.h"
19 #include "services/device/public/cpp/device_features.h" 20 #include "services/device/public/cpp/device_features.h"
20 #include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" 21 #include "third_party/WebKit/public/platform/WebRuntimeFeatures.h"
21 #include "ui/gl/gl_switches.h" 22 #include "ui/gl/gl_switches.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 WebRuntimeFeatures::EnableFeatureFromString("IdleTimeSpellChecking", true); 380 WebRuntimeFeatures::EnableFeatureFromString("IdleTimeSpellChecking", true);
380 381
381 if (media::GetEffectiveAutoplayPolicy(command_line) != 382 if (media::GetEffectiveAutoplayPolicy(command_line) !=
382 switches::autoplay::kNoUserGestureRequiredPolicy) { 383 switches::autoplay::kNoUserGestureRequiredPolicy) {
383 WebRuntimeFeatures::EnableAutoplayMutedVideos(true); 384 WebRuntimeFeatures::EnableAutoplayMutedVideos(true);
384 } 385 }
385 386
386 WebRuntimeFeatures::EnableLocationHardReload( 387 WebRuntimeFeatures::EnableLocationHardReload(
387 base::FeatureList::IsEnabled(features::kLocationHardReload)); 388 base::FeatureList::IsEnabled(features::kLocationHardReload));
388 389
390 WebRuntimeFeatures::EnableShowClientPlaceholdersForServerLoFi(
391 command_line.HasSwitch(
392 switches::kEnableShowClientPlaceholdersForServerLoFi) ||
393 (!command_line.HasSwitch(
394 switches::kDisableShowClientPlaceholdersForServerLoFi) &&
395 base::GetFieldTrialParamValue("PreviewsClientLoFi",
396 "replace_server_placeholders") == "true"));
397
389 // Enable explicitly enabled features, and then disable explicitly disabled 398 // Enable explicitly enabled features, and then disable explicitly disabled
390 // ones. 399 // ones.
391 if (command_line.HasSwitch(switches::kEnableBlinkFeatures)) { 400 if (command_line.HasSwitch(switches::kEnableBlinkFeatures)) {
392 std::vector<std::string> enabled_features = base::SplitString( 401 std::vector<std::string> enabled_features = base::SplitString(
393 command_line.GetSwitchValueASCII(switches::kEnableBlinkFeatures), 402 command_line.GetSwitchValueASCII(switches::kEnableBlinkFeatures),
394 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 403 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
395 for (const std::string& feature : enabled_features) 404 for (const std::string& feature : enabled_features)
396 WebRuntimeFeatures::EnableFeatureFromString(feature, true); 405 WebRuntimeFeatures::EnableFeatureFromString(feature, true);
397 } 406 }
398 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { 407 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) {
399 std::vector<std::string> disabled_features = base::SplitString( 408 std::vector<std::string> disabled_features = base::SplitString(
400 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), 409 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures),
401 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 410 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
402 for (const std::string& feature : disabled_features) 411 for (const std::string& feature : disabled_features)
403 WebRuntimeFeatures::EnableFeatureFromString(feature, false); 412 WebRuntimeFeatures::EnableFeatureFromString(feature, false);
404 } 413 }
405 } 414 }
406 415
407 } // namespace content 416 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698