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

Side by Side Diff: ios/chrome/browser/experimental_flags.mm

Issue 1131303003: [iOS] Upstream experimental_flags::IsAlertOnBackgroundUploadEnabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « ios/chrome/browser/experimental_flags.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 10 #include <string>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "components/variations/variations_associated_data.h" 15 #include "components/variations/variations_associated_data.h"
16 #include "ios/chrome/browser/chrome_switches.h" 16 #include "ios/chrome/browser/chrome_switches.h"
17 17
18 namespace {
19 NSString* const kEnableAlertOnBackgroundUpload =
20 @"EnableAlertsOnBackgroundUpload";
21 } // namespace
22
18 namespace experimental_flags { 23 namespace experimental_flags {
19 24
25 bool IsAlertOnBackgroundUploadEnabled() {
26 return [[NSUserDefaults standardUserDefaults]
27 boolForKey:kEnableAlertOnBackgroundUpload];
28 }
29
20 bool IsOpenFromClipboardEnabled() { 30 bool IsOpenFromClipboardEnabled() {
21 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 31 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
22 return command_line->HasSwitch(switches::kEnableIOSOpenFromClipboard); 32 return command_line->HasSwitch(switches::kEnableIOSOpenFromClipboard);
23 } 33 }
24 34
25 size_t MemoryWedgeSizeInMB() { 35 size_t MemoryWedgeSizeInMB() {
26 std::string wedge_size_string; 36 std::string wedge_size_string;
27 37
28 // Get the size from the Experimental setting. 38 // Get the size from the Experimental setting.
29 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 39 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
30 wedge_size_string = 40 wedge_size_string =
31 command_line->GetSwitchValueASCII(switches::kIOSMemoryWedgeSize); 41 command_line->GetSwitchValueASCII(switches::kIOSMemoryWedgeSize);
32 42
33 // Otherwise, get from a variation param. 43 // Otherwise, get from a variation param.
34 if (wedge_size_string.empty()) { 44 if (wedge_size_string.empty()) {
35 wedge_size_string = 45 wedge_size_string =
36 variations::GetVariationParamValue("MemoryWedge", "wedge_size"); 46 variations::GetVariationParamValue("MemoryWedge", "wedge_size");
37 } 47 }
38 48
39 // Parse the value. 49 // Parse the value.
40 size_t wedge_size_in_mb = 0; 50 size_t wedge_size_in_mb = 0;
41 if (base::StringToSizeT(wedge_size_string, &wedge_size_in_mb)) 51 if (base::StringToSizeT(wedge_size_string, &wedge_size_in_mb))
42 return wedge_size_in_mb; 52 return wedge_size_in_mb;
43 return 0; 53 return 0;
44 } 54 }
45 55
46 } // namespace experimental_flags 56 } // namespace experimental_flags
OLDNEW
« no previous file with comments | « ios/chrome/browser/experimental_flags.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698