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 #include "ios/chrome/browser/ui/webui/flags_ui.h" | 5 #include "ios/chrome/browser/ui/webui/flags_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "components/flags_ui/flags_ui_constants.h" | 16 #include "components/flags_ui/flags_ui_constants.h" |
16 #include "components/flags_ui/flags_ui_pref_names.h" | 17 #include "components/flags_ui/flags_ui_pref_names.h" |
17 #include "components/flags_ui/pref_service_flags_storage.h" | 18 #include "components/flags_ui/pref_service_flags_storage.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 void FlagsDOMHandler::HandleRequestExperimentalFeatures( | 149 void FlagsDOMHandler::HandleRequestExperimentalFeatures( |
149 const base::ListValue* args) { | 150 const base::ListValue* args) { |
150 experimental_features_requested_ = true; | 151 experimental_features_requested_ = true; |
151 // Bail out if the handler hasn't been initialized yet. The request will be | 152 // Bail out if the handler hasn't been initialized yet. The request will be |
152 // handled after the initialization. | 153 // handled after the initialization. |
153 if (!flags_storage_) | 154 if (!flags_storage_) |
154 return; | 155 return; |
155 | 156 |
156 base::DictionaryValue results; | 157 base::DictionaryValue results; |
157 | 158 |
158 std::unique_ptr<base::ListValue> supported_features(new base::ListValue); | 159 auto supported_features = base::MakeUnique<base::ListValue>(); |
159 std::unique_ptr<base::ListValue> unsupported_features(new base::ListValue); | 160 auto unsupported_features = base::MakeUnique<base::ListValue>(); |
160 GetFlagFeatureEntries(flags_storage_.get(), access_, supported_features.get(), | 161 GetFlagFeatureEntries(flags_storage_.get(), access_, supported_features.get(), |
161 unsupported_features.get()); | 162 unsupported_features.get()); |
162 results.Set(flags_ui::kSupportedFeatures, supported_features.release()); | 163 results.Set(flags_ui::kSupportedFeatures, std::move(supported_features)); |
163 results.Set(flags_ui::kUnsupportedFeatures, unsupported_features.release()); | 164 results.Set(flags_ui::kUnsupportedFeatures, std::move(unsupported_features)); |
164 // Cannot restart the browser on iOS. | 165 // Cannot restart the browser on iOS. |
165 results.SetBoolean(flags_ui::kNeedsRestart, false); | 166 results.SetBoolean(flags_ui::kNeedsRestart, false); |
166 results.SetBoolean(flags_ui::kShowOwnerWarning, | 167 results.SetBoolean(flags_ui::kShowOwnerWarning, |
167 access_ == flags_ui::kGeneralAccessFlagsOnly); | 168 access_ == flags_ui::kGeneralAccessFlagsOnly); |
168 | 169 |
169 results.SetBoolean(flags_ui::kShowBetaChannelPromotion, false); | 170 results.SetBoolean(flags_ui::kShowBetaChannelPromotion, false); |
170 results.SetBoolean(flags_ui::kShowDevChannelPromotion, false); | 171 results.SetBoolean(flags_ui::kShowDevChannelPromotion, false); |
171 web_ui()->CallJavascriptFunction(flags_ui::kReturnExperimentalFeatures, | 172 web_ui()->CallJavascriptFunction(flags_ui::kReturnExperimentalFeatures, |
172 results); | 173 results); |
173 } | 174 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 /////////////////////////////////////////////////////////////////////////////// | 244 /////////////////////////////////////////////////////////////////////////////// |
244 // | 245 // |
245 // AppleFlagsUI | 246 // AppleFlagsUI |
246 // | 247 // |
247 /////////////////////////////////////////////////////////////////////////////// | 248 /////////////////////////////////////////////////////////////////////////////// |
248 | 249 |
249 AppleFlagsUI::AppleFlagsUI(web::WebUIIOS* web_ui) | 250 AppleFlagsUI::AppleFlagsUI(web::WebUIIOS* web_ui) |
250 : BaseFlagsUI(web_ui, BaseFlagsUI::FLAGS_UI_APPLE) {} | 251 : BaseFlagsUI(web_ui, BaseFlagsUI::FLAGS_UI_APPLE) {} |
251 | 252 |
252 AppleFlagsUI::~AppleFlagsUI() {} | 253 AppleFlagsUI::~AppleFlagsUI() {} |
OLD | NEW |