Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This file can be empty. Its purpose is to contain the relatively short lived | 5 // This file can be empty. Its purpose is to contain the relatively short lived |
| 6 // definitions required for experimental flags. | 6 // definitions required for experimental flags. |
| 7 | 7 |
| 8 #include "ios/chrome/browser/experimental_flags.h" | 8 #include "ios/chrome/browser/experimental_flags.h" |
| 9 | 9 |
| 10 #include <string> | |
| 11 | |
| 10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/metrics/field_trial.h" | |
| 14 #include "base/strings/string_number_conversions.h" | |
| 15 #include "components/variations/variations_associated_data.h" | |
| 11 #include "ios/chrome/browser/chrome_switches.h" | 16 #include "ios/chrome/browser/chrome_switches.h" |
| 12 | 17 |
| 13 namespace experimental_flags { | 18 namespace experimental_flags { |
| 14 | 19 |
| 15 bool IsOpenFromClipboardEnabled() { | 20 bool IsOpenFromClipboardEnabled() { |
| 16 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 21 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 17 return command_line->HasSwitch(switches::kEnableIOSOpenFromClipboard); | 22 return command_line->HasSwitch(switches::kEnableIOSOpenFromClipboard); |
| 18 } | 23 } |
| 19 | 24 |
| 25 size_t MemoryWedgeSizeInMB() { | |
| 26 std::string wedge_size_string; | |
| 27 | |
| 28 // Get the size from the Experimental setting. | |
| 29 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 30 wedge_size_string = | |
| 31 command_line->GetSwitchValueASCII(switches::kIOSMemoryWedgeSize); | |
| 32 | |
| 33 // Otherwise, get from Finch. | |
|
Alexei Svitkine (slow)
2015/04/28 18:43:40
Nit: Finch is a codename, so we avoid using in cod
lpromero
2015/04/28 22:01:45
Done.
| |
| 34 if (wedge_size_string.empty()) { | |
| 35 wedge_size_string = | |
| 36 variations::GetVariationParamValue("MemoryWedge", "wedge_size"); | |
| 37 } | |
| 38 | |
| 39 // Parse the value. | |
| 40 unsigned wedge_size_in_mb = 0; | |
| 41 if (base::StringToUint(wedge_size_string, &wedge_size_in_mb)) | |
|
Alexei Svitkine (slow)
2015/04/28 18:43:40
Change to StringToSizeT
lpromero
2015/04/28 22:01:45
Done.
| |
| 42 return wedge_size_in_mb; | |
| 43 return 0; | |
| 44 } | |
| 45 | |
| 20 } // namespace experimental_flags | 46 } // namespace experimental_flags |
| OLD | NEW |