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

Side by Side Diff: chrome/browser/about_flags.cc

Issue 2850003002: Add flag to override Effective Connection Type (Closed)
Patch Set: ryansturm nits Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/flag_descriptions.h » ('j') | chrome/browser/io_thread.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/about_flags.h" 5 #include "chrome/browser/about_flags.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 #include "device/base/features.h" 78 #include "device/base/features.h"
79 #include "device/vr/features/features.h" 79 #include "device/vr/features/features.h"
80 #include "extensions/features/features.h" 80 #include "extensions/features/features.h"
81 #include "gin/public/gin_features.h" 81 #include "gin/public/gin_features.h"
82 #include "gpu/config/gpu_switches.h" 82 #include "gpu/config/gpu_switches.h"
83 #include "media/audio/audio_features.h" 83 #include "media/audio/audio_features.h"
84 #include "media/base/media_switches.h" 84 #include "media/base/media_switches.h"
85 #include "media/media_features.h" 85 #include "media/media_features.h"
86 #include "media/midi/midi_switches.h" 86 #include "media/midi/midi_switches.h"
87 #include "net/cert/cert_verify_proc_android.h" 87 #include "net/cert/cert_verify_proc_android.h"
88 #include "net/nqe/effective_connection_type.h"
88 #include "ppapi/features/features.h" 89 #include "ppapi/features/features.h"
89 #include "printing/features/features.h" 90 #include "printing/features/features.h"
90 #include "services/device/public/cpp/device_features.h" 91 #include "services/device/public/cpp/device_features.h"
91 #include "ui/base/ui_base_switches.h" 92 #include "ui/base/ui_base_switches.h"
92 #include "ui/compositor/compositor_switches.h" 93 #include "ui/compositor/compositor_switches.h"
93 #include "ui/display/display_switches.h" 94 #include "ui/display/display_switches.h"
94 #include "ui/events/event_switches.h" 95 #include "ui/events/event_switches.h"
95 #include "ui/gfx/switches.h" 96 #include "ui/gfx/switches.h"
96 #include "ui/gl/gl_features.h" 97 #include "ui/gl/gl_features.h"
97 #include "ui/gl/gl_switches.h" 98 #include "ui/gl/gl_switches.h"
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 #if defined(OS_ANDROID) 701 #if defined(OS_ANDROID)
701 {flag_descriptions::kAutoplayPolicyUserGestureRequired, 702 {flag_descriptions::kAutoplayPolicyUserGestureRequired,
702 switches::kAutoplayPolicy, switches::autoplay::kUserGestureRequiredPolicy}, 703 switches::kAutoplayPolicy, switches::autoplay::kUserGestureRequiredPolicy},
703 #else 704 #else
704 {flag_descriptions::kAutoplayPolicyCrossOriginUserGestureRequired, 705 {flag_descriptions::kAutoplayPolicyCrossOriginUserGestureRequired,
705 switches::kAutoplayPolicy, 706 switches::kAutoplayPolicy,
706 switches::autoplay::kCrossOriginUserGestureRequiredPolicy}, 707 switches::autoplay::kCrossOriginUserGestureRequiredPolicy},
707 #endif 708 #endif
708 }; 709 };
709 710
711 const FeatureEntry::Choice kForceEffectiveConnectionTypeChoices[] = {
712 {flags_ui::kGenericExperimentChoiceDefault, "", ""},
713 {flag_descriptions::kEffectiveConnectionTypeUnknownDescription,
714 switches::kForceEffectiveConnectionType,
715 net::kEffectiveConnectionTypeUnknown},
716 {flag_descriptions::kEffectiveConnectionTypeOfflineDescription,
717 switches::kForceEffectiveConnectionType,
718 net::kEffectiveConnectionTypeOffline},
719 {flag_descriptions::kEffectiveConnectionTypeSlow2GDescription,
720 switches::kForceEffectiveConnectionType,
721 net::kEffectiveConnectionTypeSlow2G},
722 {flag_descriptions::kEffectiveConnectionType2GDescription,
723 switches::kForceEffectiveConnectionType, net::kEffectiveConnectionType2G},
724 {flag_descriptions::kEffectiveConnectionType3GDescription,
725 switches::kForceEffectiveConnectionType, net::kEffectiveConnectionType3G},
726 {flag_descriptions::kEffectiveConnectionType4GDescription,
727 switches::kForceEffectiveConnectionType, net::kEffectiveConnectionType4G},
728 };
729
730 // Ensure that all effective connection types returned by Network Quality
731 // Estimator (NQE) are also exposed via flags.
732 static_assert(net::EFFECTIVE_CONNECTION_TYPE_LAST + 1 ==
733 arraysize(kForceEffectiveConnectionTypeChoices),
734 "ECT enum value is not handled.");
735 static_assert(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN == 0,
736 "ECT enum value is not handled.");
737 static_assert(net::EFFECTIVE_CONNECTION_TYPE_4G + 1 ==
738 net::EFFECTIVE_CONNECTION_TYPE_LAST,
739 "ECT enum value is not handled.");
740
710 const FeatureEntry::FeatureParam kNoStatePrefetchEnabled[] = { 741 const FeatureEntry::FeatureParam kNoStatePrefetchEnabled[] = {
711 {prerender::kNoStatePrefetchFeatureModeParameterName, 742 {prerender::kNoStatePrefetchFeatureModeParameterName,
712 prerender::kNoStatePrefetchFeatureModeParameterPrefetch}}; 743 prerender::kNoStatePrefetchFeatureModeParameterPrefetch}};
713 744
714 const FeatureEntry::FeatureParam kNoStatePrefetchPrerender[] = { 745 const FeatureEntry::FeatureParam kNoStatePrefetchPrerender[] = {
715 {prerender::kNoStatePrefetchFeatureModeParameterName, 746 {prerender::kNoStatePrefetchFeatureModeParameterName,
716 prerender::kNoStatePrefetchFeatureModeParameterPrerender}}; 747 prerender::kNoStatePrefetchFeatureModeParameterPrerender}};
717 748
718 const FeatureEntry::FeatureParam kNoStatePrefetchSimpleLoad[] = { 749 const FeatureEntry::FeatureParam kNoStatePrefetchSimpleLoad[] = {
719 {prerender::kNoStatePrefetchFeatureModeParameterName, 750 {prerender::kNoStatePrefetchFeatureModeParameterName,
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after
2762 {"enable-clipboard-provider", 2793 {"enable-clipboard-provider",
2763 flag_descriptions::kEnableOmniboxClipboardProviderName, 2794 flag_descriptions::kEnableOmniboxClipboardProviderName,
2764 flag_descriptions::kEnableOmniboxClipboardProviderDescription, kOsAndroid, 2795 flag_descriptions::kEnableOmniboxClipboardProviderDescription, kOsAndroid,
2765 FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProvider)}, 2796 FEATURE_VALUE_TYPE(omnibox::kEnableClipboardProvider)},
2766 #endif 2797 #endif
2767 2798
2768 {"autoplay-policy", flag_descriptions::kAutoplayPolicyName, 2799 {"autoplay-policy", flag_descriptions::kAutoplayPolicyName,
2769 flag_descriptions::kAutoplayPolicyDescription, kOsAll, 2800 flag_descriptions::kAutoplayPolicyDescription, kOsAll,
2770 MULTI_VALUE_TYPE(kAutoplayPolicyChoices)}, 2801 MULTI_VALUE_TYPE(kAutoplayPolicyChoices)},
2771 2802
2803 {"force-effective-connection-type",
2804 flag_descriptions::kForceEffectiveConnectionTypeName,
2805 flag_descriptions::kForceEffectiveConnectionTypeDescription, kOsAll,
2806 MULTI_VALUE_TYPE(kForceEffectiveConnectionTypeChoices)},
2807
2772 {"enable-heap-profiling", flag_descriptions::kEnableHeapProfilingName, 2808 {"enable-heap-profiling", flag_descriptions::kEnableHeapProfilingName,
2773 flag_descriptions::kEnableHeapProfilingDescription, kOsAll, 2809 flag_descriptions::kEnableHeapProfilingDescription, kOsAll,
2774 MULTI_VALUE_TYPE(kEnableHeapProfilingChoices)}, 2810 MULTI_VALUE_TYPE(kEnableHeapProfilingChoices)},
2775 2811
2776 // NOTE: Adding new command-line switches requires adding corresponding 2812 // NOTE: Adding new command-line switches requires adding corresponding
2777 // entries to enum "LoginCustomFlags" in histograms.xml. See note in 2813 // entries to enum "LoginCustomFlags" in histograms.xml. See note in
2778 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. 2814 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test.
2779 }; 2815 };
2780 2816
2781 class FlagsStateSingleton { 2817 class FlagsStateSingleton {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2991 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; 3027 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0;
2992 3028
2993 const FeatureEntry* GetFeatureEntries(size_t* count) { 3029 const FeatureEntry* GetFeatureEntries(size_t* count) {
2994 *count = arraysize(kFeatureEntries); 3030 *count = arraysize(kFeatureEntries);
2995 return kFeatureEntries; 3031 return kFeatureEntries;
2996 } 3032 }
2997 3033
2998 } // namespace testing 3034 } // namespace testing
2999 3035
3000 } // namespace about_flags 3036 } // namespace about_flags
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/flag_descriptions.h » ('j') | chrome/browser/io_thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698