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

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

Issue 1458043003: Added --force-ui-direction flag for developers to force LTR or RTL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years 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 | « chrome/app/generated_resources.grd ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/feature_list.h" 15 #include "base/feature_list.h"
16 #include "base/i18n/base_i18n_switches.h"
16 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
17 #include "base/metrics/metrics_hashes.h" 18 #include "base/metrics/metrics_hashes.h"
18 #include "base/metrics/sparse_histogram.h" 19 #include "base/metrics/sparse_histogram.h"
19 #include "base/stl_util.h" 20 #include "base/stl_util.h"
20 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
22 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
23 #include "base/values.h" 24 #include "base/values.h"
24 #include "cc/base/switches.h" 25 #include "cc/base/switches.h"
25 #include "chrome/common/channel_info.h" 26 #include "chrome/common/channel_info.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 "application/x-google-chrome-pdf,application/pdf"}, 507 "application/x-google-chrome-pdf,application/pdf"},
507 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_FLASH_AND_PDF, 508 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_FLASH_AND_PDF,
508 switches::kEnableWin32kLockDownMimeTypes, 509 switches::kEnableWin32kLockDownMimeTypes,
509 "application/x-shockwave-flash,application/futuresplash," 510 "application/x-shockwave-flash,application/futuresplash,"
510 "application/x-google-chrome-pdf,application/pdf"}, 511 "application/x-google-chrome-pdf,application/pdf"},
511 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_ALL, 512 {IDS_FLAGS_PPAPI_WIN32K_LOCKDOWN_ALL,
512 switches::kEnableWin32kLockDownMimeTypes, "*"}, 513 switches::kEnableWin32kLockDownMimeTypes, "*"},
513 }; 514 };
514 #endif // defined(OS_WIN) 515 #endif // defined(OS_WIN)
515 516
517 const FeatureEntry::Choice kForceUIDirectionChoices[] = {
518 {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""},
519 {IDS_FLAGS_FORCE_UI_DIRECTION_LTR, switches::kForceUIDirection,
520 switches::kForceUIDirectionLTR},
521 {IDS_FLAGS_FORCE_UI_DIRECTION_RTL, switches::kForceUIDirection,
522 switches::kForceUIDirectionRTL},
523 };
524
516 // RECORDING USER METRICS FOR FLAGS: 525 // RECORDING USER METRICS FOR FLAGS:
517 // ----------------------------------------------------------------------------- 526 // -----------------------------------------------------------------------------
518 // The first line of the entry is the internal name. If you'd like to gather 527 // The first line of the entry is the internal name. If you'd like to gather
519 // statistics about the usage of your flag, you should append a marker comment 528 // statistics about the usage of your flag, you should append a marker comment
520 // to the end of the feature name, like so: 529 // to the end of the feature name, like so:
521 // "my-special-feature", // FLAGS:RECORD_UMA 530 // "my-special-feature", // FLAGS:RECORD_UMA
522 // 531 //
523 // After doing that, run 532 // After doing that, run
524 // tools/metrics/actions/extract_actions.py 533 // tools/metrics/actions/extract_actions.py
525 // to add the metric to actions.xml (which will enable UMA to record your 534 // to add the metric to actions.xml (which will enable UMA to record your
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 IDS_FLAGS_ENABLE_MATERIAL_DESIGN_HISTORY_DESCRIPTION, 2091 IDS_FLAGS_ENABLE_MATERIAL_DESIGN_HISTORY_DESCRIPTION,
2083 kOsDesktop | kOsAndroid, 2092 kOsDesktop | kOsAndroid,
2084 SINGLE_VALUE_TYPE(switches::kEnableMaterialDesignHistory)}, 2093 SINGLE_VALUE_TYPE(switches::kEnableMaterialDesignHistory)},
2085 #if defined(OS_WIN) 2094 #if defined(OS_WIN)
2086 {"enable-windows-desktop-search-redirection", 2095 {"enable-windows-desktop-search-redirection",
2087 IDS_FLAGS_WINDOWS_DESKTOP_SEARCH_REDIRECTION_NAME, 2096 IDS_FLAGS_WINDOWS_DESKTOP_SEARCH_REDIRECTION_NAME,
2088 IDS_FLAGS_WINDOWS_DESKTOP_SEARCH_REDIRECTION_DESCRIPTION, 2097 IDS_FLAGS_WINDOWS_DESKTOP_SEARCH_REDIRECTION_DESCRIPTION,
2089 kOsWin, 2098 kOsWin,
2090 FEATURE_VALUE_TYPE(kWindowsDesktopSearchRedirectionFeature)}, 2099 FEATURE_VALUE_TYPE(kWindowsDesktopSearchRedirectionFeature)},
2091 #endif // defined(OS_WIN) 2100 #endif // defined(OS_WIN)
2101 {"force-ui-direction",
2102 IDS_FLAGS_FORCE_UI_DIRECTION_NAME,
2103 IDS_FLAGS_FORCE_UI_DIRECTION_DESCRIPTION,
2104 kOsAll,
2105 MULTI_VALUE_TYPE(kForceUIDirectionChoices)},
2092 // NOTE: Adding new command-line switches requires adding corresponding 2106 // NOTE: Adding new command-line switches requires adding corresponding
2093 // entries to enum "LoginCustomFlags" in histograms.xml. See note in 2107 // entries to enum "LoginCustomFlags" in histograms.xml. See note in
2094 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. 2108 // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test.
2095 }; 2109 };
2096 2110
2097 class FlagsStateSingleton { 2111 class FlagsStateSingleton {
2098 public: 2112 public:
2099 FlagsStateSingleton() 2113 FlagsStateSingleton()
2100 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {} 2114 : flags_state_(kFeatureEntries, arraysize(kFeatureEntries)) {}
2101 ~FlagsStateSingleton() {} 2115 ~FlagsStateSingleton() {}
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0; 2309 const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0;
2296 2310
2297 const FeatureEntry* GetFeatureEntries(size_t* count) { 2311 const FeatureEntry* GetFeatureEntries(size_t* count) {
2298 *count = arraysize(kFeatureEntries); 2312 *count = arraysize(kFeatureEntries);
2299 return kFeatureEntries; 2313 return kFeatureEntries;
2300 } 2314 }
2301 2315
2302 } // namespace testing 2316 } // namespace testing
2303 2317
2304 } // namespace about_flags 2318 } // namespace about_flags
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698