| 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/memory/ref_counted_memory.h" | 13 #include "base/memory/ref_counted_memory.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" |
| 18 #include "components/grit/components_resources.h" | 19 #include "components/grit/components_resources.h" |
| 19 #include "components/grit/components_scaled_resources.h" | 20 #include "components/grit/components_scaled_resources.h" |
| 20 #include "components/prefs/pref_registry_simple.h" | 21 #include "components/prefs/pref_registry_simple.h" |
| 21 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // | 208 // |
| 208 /////////////////////////////////////////////////////////////////////////////// | 209 /////////////////////////////////////////////////////////////////////////////// |
| 209 | 210 |
| 210 BaseFlagsUI::BaseFlagsUI(web::WebUIIOS* web_ui, FlagsUIKind flags_ui_kind) | 211 BaseFlagsUI::BaseFlagsUI(web::WebUIIOS* web_ui, FlagsUIKind flags_ui_kind) |
| 211 : web::WebUIIOSController(web_ui), weak_factory_(this) { | 212 : web::WebUIIOSController(web_ui), weak_factory_(this) { |
| 212 Initialize(web_ui, flags_ui_kind); | 213 Initialize(web_ui, flags_ui_kind); |
| 213 } | 214 } |
| 214 | 215 |
| 215 void BaseFlagsUI::Initialize(web::WebUIIOS* web_ui, FlagsUIKind flags_ui_kind) { | 216 void BaseFlagsUI::Initialize(web::WebUIIOS* web_ui, FlagsUIKind flags_ui_kind) { |
| 216 FlagsDOMHandler* handler = new FlagsDOMHandler(); | 217 FlagsDOMHandler* handler = new FlagsDOMHandler(); |
| 217 web_ui->AddMessageHandler(handler); | 218 web_ui->AddMessageHandler(base::WrapUnique(handler)); |
| 218 | 219 |
| 219 flags_ui::FlagAccess flag_access = flags_ui::kOwnerAccessToFlags; | 220 flags_ui::FlagAccess flag_access = flags_ui::kOwnerAccessToFlags; |
| 220 if (flags_ui_kind == FLAGS_UI_APPLE) | 221 if (flags_ui_kind == FLAGS_UI_APPLE) |
| 221 flag_access = flags_ui::kAppleReviewAccessToFlags; | 222 flag_access = flags_ui::kAppleReviewAccessToFlags; |
| 222 handler->Init(new flags_ui::PrefServiceFlagsStorage( | 223 handler->Init(new flags_ui::PrefServiceFlagsStorage( |
| 223 GetApplicationContext()->GetLocalState()), | 224 GetApplicationContext()->GetLocalState()), |
| 224 flag_access); | 225 flag_access); |
| 225 | 226 |
| 226 // Set up the about:flags source. | 227 // Set up the about:flags source. |
| 227 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), | 228 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 251 /////////////////////////////////////////////////////////////////////////////// | 252 /////////////////////////////////////////////////////////////////////////////// |
| 252 // | 253 // |
| 253 // AppleFlagsUI | 254 // AppleFlagsUI |
| 254 // | 255 // |
| 255 /////////////////////////////////////////////////////////////////////////////// | 256 /////////////////////////////////////////////////////////////////////////////// |
| 256 | 257 |
| 257 AppleFlagsUI::AppleFlagsUI(web::WebUIIOS* web_ui) | 258 AppleFlagsUI::AppleFlagsUI(web::WebUIIOS* web_ui) |
| 258 : BaseFlagsUI(web_ui, BaseFlagsUI::FLAGS_UI_APPLE) {} | 259 : BaseFlagsUI(web_ui, BaseFlagsUI::FLAGS_UI_APPLE) {} |
| 259 | 260 |
| 260 AppleFlagsUI::~AppleFlagsUI() {} | 261 AppleFlagsUI::~AppleFlagsUI() {} |
| OLD | NEW |