| 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/version_handler.h" | 5 #include "ios/chrome/browser/ui/webui/version_handler.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/values.h" | 11 #include "base/values.h" |
| 11 #include "components/version_ui/version_handler_helper.h" | 12 #include "components/version_ui/version_handler_helper.h" |
| 12 #include "components/version_ui/version_ui_constants.h" | 13 #include "components/version_ui/version_ui_constants.h" |
| 13 #include "ios/public/provider/web/web_ui_ios.h" | 14 #include "ios/public/provider/web/web_ui_ios.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 15 | 16 |
| 16 VersionHandler::VersionHandler() {} | 17 VersionHandler::VersionHandler() {} |
| 17 | 18 |
| 18 VersionHandler::~VersionHandler() {} | 19 VersionHandler::~VersionHandler() {} |
| 19 | 20 |
| 20 void VersionHandler::RegisterMessages() { | 21 void VersionHandler::RegisterMessages() { |
| 21 web_ui()->RegisterMessageCallback( | 22 web_ui()->RegisterMessageCallback( |
| 22 version_ui::kRequestVersionInfo, | 23 version_ui::kRequestVersionInfo, |
| 23 base::Bind(&VersionHandler::HandleRequestVersionInfo, | 24 base::Bind(&VersionHandler::HandleRequestVersionInfo, |
| 24 base::Unretained(this))); | 25 base::Unretained(this))); |
| 25 } | 26 } |
| 26 | 27 |
| 27 void VersionHandler::HandleRequestVersionInfo(const base::ListValue* args) { | 28 void VersionHandler::HandleRequestVersionInfo(const base::ListValue* args) { |
| 28 // Respond with the variations info immediately. | 29 // Respond with the variations info immediately. |
| 29 web_ui()->CallJavascriptFunction(version_ui::kReturnVariationInfo, | 30 web_ui()->CallJavascriptFunction(version_ui::kReturnVariationInfo, |
| 30 *version_ui::GetVariationsList()); | 31 *version_ui::GetVariationsList()); |
| 31 } | 32 } |
| OLD | NEW |