blob: 395a459a27aba0ecc9141bdc34e8357d656d3be5 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "components/login/secure_module_util_chromeos.h"
#include "content/public/browser/web_ui.h"
namespace base {
class DictionaryValue;
namespace chromeos {
class CoreOobeView;
class EulaScreen;
class HelpAppLauncher;
// Interface between eula screen and its representation, either WebUI
// or Views one. Note, do not forget to call OnViewDestroyed in the
// dtor.
class EulaView {
constexpr static StaticOobeScreenId kScreenId{"eula"};
virtual ~EulaView() {}
virtual void Show() = 0;
virtual void Hide() = 0;
virtual void Bind(EulaScreen* screen) = 0;
virtual void Unbind() = 0;
virtual void OnPasswordFetched(const std::string& tpm_password) = 0;
// WebUI implementation of EulaScreenView. It is used to interact
// with the eula part of the JS page.
class EulaScreenHandler : public EulaView, public BaseScreenHandler {
using TView = EulaView;
EulaScreenHandler(JSCallsContainer* js_calls_container,
CoreOobeView* core_oobe_view);
~EulaScreenHandler() override;
// EulaView implementation:
void Show() override;
void Hide() override;
void Bind(EulaScreen* screen) override;
void Unbind() override;
void OnPasswordFetched(const std::string& tpm_password) override;
// BaseScreenHandler implementation:
void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override;
void DeclareJSCallbacks() override;
void GetAdditionalParameters(base::DictionaryValue* dict) override;
void Initialize() override;
// JS messages handlers.
void HandleOnLearnMore();
void HandleOnInstallationSettingsPopupOpened();
void HandleUsageStatsEnabled(bool enabled);
void UpdateLocalizedValues(::login::SecureModuleUsed secure_module_used);
EulaScreen* screen_ = nullptr;
CoreOobeView* core_oobe_view_ = nullptr;
// Help application used for help dialogs.
scoped_refptr<HelpAppLauncher> help_app_;
// Keeps whether screen should be shown right after initialization.
bool show_on_init_ = false;
base::WeakPtrFactory<EulaScreenHandler> weak_factory_;
} // namespace chromeos