| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "components/flags_ui/flags_ui_constants.h" | 15 #include "components/flags_ui/flags_ui_constants.h" |
| 15 #include "components/flags_ui/flags_ui_pref_names.h" | 16 #include "components/flags_ui/flags_ui_pref_names.h" |
| 16 #include "components/flags_ui/pref_service_flags_storage.h" | 17 #include "components/flags_ui/pref_service_flags_storage.h" |
| 17 #include "components/grit/components_resources.h" | 18 #include "components/grit/components_resources.h" |
| 18 #include "components/prefs/pref_registry_simple.h" | 19 #include "components/prefs/pref_registry_simple.h" |
| 19 #include "components/prefs/pref_service.h" | 20 #include "components/prefs/pref_service.h" |
| 20 #include "components/strings/grit/components_chromium_strings.h" | 21 #include "components/strings/grit/components_chromium_strings.h" |
| 21 #include "components/strings/grit/components_strings.h" | 22 #include "components/strings/grit/components_strings.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // | 206 // |
| 206 /////////////////////////////////////////////////////////////////////////////// | 207 /////////////////////////////////////////////////////////////////////////////// |
| 207 | 208 |
| 208 BaseFlagsUI::BaseFlagsUI(web::WebUIIOS* web_ui, FlagsUIKind flags_ui_kind) | 209 BaseFlagsUI::BaseFlagsUI(web::WebUIIOS* web_ui, FlagsUIKind flags_ui_kind) |
| 209 : web::WebUIIOSController(web_ui), weak_factory_(this) { | 210 : web::WebUIIOSController(web_ui), weak_factory_(this) { |
| 210 Initialize(web_ui, flags_ui_kind); | 211 Initialize(web_ui, flags_ui_kind); |
| 211 } | 212 } |
| 212 | 213 |
| 213 void BaseFlagsUI::Initialize(web::WebUIIOS* web_ui, FlagsUIKind flags_ui_kind) { | 214 void BaseFlagsUI::Initialize(web::WebUIIOS* web_ui, FlagsUIKind flags_ui_kind) { |
| 214 FlagsDOMHandler* handler = new FlagsDOMHandler(); | 215 FlagsDOMHandler* handler = new FlagsDOMHandler(); |
| 215 web_ui->AddMessageHandler(handler); | 216 web_ui->AddMessageHandler(base::WrapUnique(handler)); |
| 216 | 217 |
| 217 flags_ui::FlagAccess flag_access = flags_ui::kOwnerAccessToFlags; | 218 flags_ui::FlagAccess flag_access = flags_ui::kOwnerAccessToFlags; |
| 218 if (flags_ui_kind == FLAGS_UI_APPLE) | 219 if (flags_ui_kind == FLAGS_UI_APPLE) |
| 219 flag_access = flags_ui::kAppleReviewAccessToFlags; | 220 flag_access = flags_ui::kAppleReviewAccessToFlags; |
| 220 handler->Init(new flags_ui::PrefServiceFlagsStorage( | 221 handler->Init(new flags_ui::PrefServiceFlagsStorage( |
| 221 GetApplicationContext()->GetLocalState()), | 222 GetApplicationContext()->GetLocalState()), |
| 222 flag_access); | 223 flag_access); |
| 223 | 224 |
| 224 // Set up the about:flags source. | 225 // Set up the about:flags source. |
| 225 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), | 226 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 242 /////////////////////////////////////////////////////////////////////////////// | 243 /////////////////////////////////////////////////////////////////////////////// |
| 243 // | 244 // |
| 244 // AppleFlagsUI | 245 // AppleFlagsUI |
| 245 // | 246 // |
| 246 /////////////////////////////////////////////////////////////////////////////// | 247 /////////////////////////////////////////////////////////////////////////////// |
| 247 | 248 |
| 248 AppleFlagsUI::AppleFlagsUI(web::WebUIIOS* web_ui) | 249 AppleFlagsUI::AppleFlagsUI(web::WebUIIOS* web_ui) |
| 249 : BaseFlagsUI(web_ui, BaseFlagsUI::FLAGS_UI_APPLE) {} | 250 : BaseFlagsUI(web_ui, BaseFlagsUI::FLAGS_UI_APPLE) {} |
| 250 | 251 |
| 251 AppleFlagsUI::~AppleFlagsUI() {} | 252 AppleFlagsUI::~AppleFlagsUI() {} |
| OLD | NEW |