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 #import <Foundation/Foundation.h> | 10 #import <Foundation/Foundation.h> |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "components/enhanced_bookmarks/enhanced_bookmark_features.h" |
18 #include "components/variations/variations_associated_data.h" | 19 #include "components/variations/variations_associated_data.h" |
19 #include "ios/chrome/browser/chrome_switches.h" | 20 #include "ios/chrome/browser/chrome_switches.h" |
20 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | |
21 #include "ios/web/public/web_view_creation_util.h" | 21 #include "ios/web/public/web_view_creation_util.h" |
22 | 22 |
23 namespace { | 23 namespace { |
24 NSString* const kEnableAlertOnBackgroundUpload = | 24 NSString* const kEnableAlertOnBackgroundUpload = |
25 @"EnableAlertsOnBackgroundUpload"; | 25 @"EnableAlertsOnBackgroundUpload"; |
26 NSString* const kEnableBookmarkRefreshImageOnEachVisit = | 26 NSString* const kEnableBookmarkRefreshImageOnEachVisit = |
27 @"EnableBookmarkRefreshImageOnEachVisit"; | 27 @"EnableBookmarkRefreshImageOnEachVisit"; |
28 } // namespace | 28 } // namespace |
29 | 29 |
30 namespace experimental_flags { | 30 namespace experimental_flags { |
31 | 31 |
32 bool IsAlertOnBackgroundUploadEnabled() { | 32 bool IsAlertOnBackgroundUploadEnabled() { |
33 return [[NSUserDefaults standardUserDefaults] | 33 return [[NSUserDefaults standardUserDefaults] |
34 boolForKey:kEnableAlertOnBackgroundUpload]; | 34 boolForKey:kEnableAlertOnBackgroundUpload]; |
35 } | 35 } |
36 | 36 |
37 bool IsBookmarkCollectionEnabled() { | 37 bool IsBookmarkCollectionEnabled() { |
38 return ios::GetChromeBrowserProvider()->IsBookmarkCollectionEnabled(); | 38 return enhanced_bookmarks::IsEnhancedBookmarksEnabled(); |
39 } | 39 } |
40 | 40 |
41 bool IsBookmarkImageFetchingOnVisitEnabled() { | 41 bool IsBookmarkImageFetchingOnVisitEnabled() { |
42 if (!IsBookmarkCollectionEnabled()) | 42 if (!IsBookmarkCollectionEnabled()) |
43 return false; | 43 return false; |
44 | 44 |
45 NSUserDefaults* user_defaults = [NSUserDefaults standardUserDefaults]; | 45 NSUserDefaults* user_defaults = [NSUserDefaults standardUserDefaults]; |
46 if ([user_defaults boolForKey:kEnableBookmarkRefreshImageOnEachVisit]) | 46 if ([user_defaults boolForKey:kEnableBookmarkRefreshImageOnEachVisit]) |
47 return true; | 47 return true; |
48 | 48 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 // Parse the value. | 92 // Parse the value. |
93 size_t wedge_size_in_mb = 0; | 93 size_t wedge_size_in_mb = 0; |
94 if (base::StringToSizeT(wedge_size_string, &wedge_size_in_mb)) | 94 if (base::StringToSizeT(wedge_size_string, &wedge_size_in_mb)) |
95 return wedge_size_in_mb; | 95 return wedge_size_in_mb; |
96 return 0; | 96 return 0; |
97 } | 97 } |
98 | 98 |
99 } // namespace experimental_flags | 99 } // namespace experimental_flags |
OLD | NEW |