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

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

Issue 1491253003: Enable enhanced bookmarks by default on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missing include. 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 | « no previous file | 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 <dispatch/dispatch.h> 10 #include <dispatch/dispatch.h>
11 #import <Foundation/Foundation.h> 11 #import <Foundation/Foundation.h>
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/metrics/field_trial.h" 16 #include "base/metrics/field_trial.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "components/autofill/core/common/autofill_switches.h" 18 #include "components/autofill/core/common/autofill_switches.h"
19 #include "components/enhanced_bookmarks/enhanced_bookmark_features.h" 19 #include "components/enhanced_bookmarks/enhanced_bookmark_switches.h"
20 #include "components/variations/variations_associated_data.h" 20 #include "components/variations/variations_associated_data.h"
21 #include "ios/chrome/browser/chrome_switches.h" 21 #include "ios/chrome/browser/chrome_switches.h"
22 #include "ios/web/public/web_view_creation_util.h" 22 #include "ios/web/public/web_view_creation_util.h"
23 23
24 namespace { 24 namespace {
25 NSString* const kEnableAlertOnBackgroundUpload = 25 NSString* const kEnableAlertOnBackgroundUpload =
26 @"EnableAlertsOnBackgroundUpload"; 26 @"EnableAlertsOnBackgroundUpload";
27 NSString* const kEnableViewCopyPasswords = @"EnableViewCopyPasswords"; 27 NSString* const kEnableViewCopyPasswords = @"EnableViewCopyPasswords";
28 NSString* const kHeuristicsForPasswordGeneration = 28 NSString* const kHeuristicsForPasswordGeneration =
29 @"HeuristicsForPasswordGeneration"; 29 @"HeuristicsForPasswordGeneration";
(...skipping 11 matching lines...) Expand all
41 } // namespace 41 } // namespace
42 42
43 namespace experimental_flags { 43 namespace experimental_flags {
44 44
45 bool IsAlertOnBackgroundUploadEnabled() { 45 bool IsAlertOnBackgroundUploadEnabled() {
46 return [[NSUserDefaults standardUserDefaults] 46 return [[NSUserDefaults standardUserDefaults]
47 boolForKey:kEnableAlertOnBackgroundUpload]; 47 boolForKey:kEnableAlertOnBackgroundUpload];
48 } 48 }
49 49
50 bool IsBookmarkCollectionEnabled() { 50 bool IsBookmarkCollectionEnabled() {
51 return enhanced_bookmarks::IsEnhancedBookmarksEnabled(); 51 // kEnhancedBookmarksExperiment flag could have values "", "1" and "0".
52 // "" - default, "0" - user opted out, "1" - user opted in. Tests also use
53 // the command line flag to force enhanced bookmark to be on.
54 // If none is specified, the finch experiment is checked. If not disabled in
55 // finch, the default is opt-in.
56 std::string switch_value =
57 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
58 switches::kEnhancedBookmarksExperiment);
59 if (switch_value == "1")
60 return true;
61 if (switch_value == "0")
62 return false;
63
64 // Check if the finch experiment is turned on.
65 std::string group_name =
66 base::FieldTrialList::FindFullName("IOSNewBookmarksUI");
67 return !base::StartsWith(group_name, "Disabled",
68 base::CompareCase::INSENSITIVE_ASCII);
52 } 69 }
53 70
54 void SetWKWebViewTrialEligibility(bool eligible) { 71 void SetWKWebViewTrialEligibility(bool eligible) {
55 // It's critical that the enabled state be consistently reported throughout 72 // It's critical that the enabled state be consistently reported throughout
56 // the life of the app, so ensure that this has not already been set. 73 // the life of the app, so ensure that this has not already been set.
57 DCHECK(g_wkwebview_trial_eligibility == WKWebViewEligibility::UNSET); 74 DCHECK(g_wkwebview_trial_eligibility == WKWebViewEligibility::UNSET);
58 75
59 g_wkwebview_trial_eligibility = eligible ? WKWebViewEligibility::ELIGIBLE 76 g_wkwebview_trial_eligibility = eligible ? WKWebViewEligibility::ELIGIBLE
60 : WKWebViewEligibility::INELIGIBLE; 77 : WKWebViewEligibility::INELIGIBLE;
61 } 78 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if ([[NSUserDefaults standardUserDefaults] 222 if ([[NSUserDefaults standardUserDefaults]
206 boolForKey:kHeuristicsForPasswordGeneration]) { 223 boolForKey:kHeuristicsForPasswordGeneration]) {
207 return true; 224 return true;
208 } 225 }
209 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 226 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
210 return command_line->HasSwitch( 227 return command_line->HasSwitch(
211 autofill::switches::kLocalHeuristicsOnlyForPasswordGeneration); 228 autofill::switches::kLocalHeuristicsOnlyForPasswordGeneration);
212 } 229 }
213 230
214 } // namespace experimental_flags 231 } // namespace experimental_flags
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698