| Index: chrome/browser/ui/webui/chromeos/login/base_webui_handler.h
|
| diff --git a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h
|
| similarity index 87%
|
| copy from chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
|
| copy to chrome/browser/ui/webui/chromeos/login/base_webui_handler.h
|
| index 2e46198a8b3133fcf74b2347f5bbe7d6a0bf5daf..5b04735ab77c0df7876d58bb0488d96fed08da4e 100644
|
| --- a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
|
| +++ b/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h
|
| @@ -1,9 +1,9 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Copyright 2017 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.
|
|
|
| -#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_H_
|
| -#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_H_
|
| +#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_WEBUI_HANDLER_H_
|
| +#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_WEBUI_HANDLER_H_
|
|
|
| #include <string>
|
|
|
| @@ -33,15 +33,14 @@ class BaseScreen;
|
| class OobeUI;
|
|
|
| // Base class for the OOBE/Login WebUI handlers.
|
| -class BaseScreenHandler : public content::WebUIMessageHandler,
|
| - public ModelViewChannel {
|
| +class BaseWebUIHandler : public content::WebUIMessageHandler,
|
| + public ModelViewChannel {
|
| public:
|
| - BaseScreenHandler();
|
| - ~BaseScreenHandler() override;
|
| + BaseWebUIHandler();
|
| + ~BaseWebUIHandler() override;
|
|
|
| // Gets localized strings to be used on the page.
|
| - void GetLocalizedStrings(
|
| - base::DictionaryValue* localized_strings);
|
| + void GetLocalizedStrings(base::DictionaryValue* localized_strings);
|
|
|
| // WebUIMessageHandler implementation:
|
| void RegisterMessages() override;
|
| @@ -53,13 +52,6 @@ class BaseScreenHandler : public content::WebUIMessageHandler,
|
| // via virtual Initialize() method (see below).
|
| void InitializeBase();
|
|
|
| - void set_async_assets_load_id(const std::string& async_assets_load_id) {
|
| - async_assets_load_id_ = async_assets_load_id;
|
| - }
|
| - const std::string& async_assets_load_id() const {
|
| - return async_assets_load_id_;
|
| - }
|
| -
|
| // Set the prefix used when running CallJs with a method. For example,
|
| // set_call_js_prefix("Oobe")
|
| // CallJs("lock") -> Invokes JS global named "Oobe.lock"
|
| @@ -67,6 +59,13 @@ class BaseScreenHandler : public content::WebUIMessageHandler,
|
| js_screen_path_prefix_ = prefix + ".";
|
| }
|
|
|
| + void set_async_assets_load_id(const std::string& async_assets_load_id) {
|
| + async_assets_load_id_ = async_assets_load_id;
|
| + }
|
| + const std::string& async_assets_load_id() const {
|
| + return async_assets_load_id_;
|
| + }
|
| +
|
| protected:
|
| // All subclasses should implement this method to provide localized values.
|
| virtual void DeclareLocalizedValues(
|
| @@ -87,20 +86,20 @@ class BaseScreenHandler : public content::WebUIMessageHandler,
|
| // Shortcut for calling JS methods on WebUI side.
|
| void CallJS(const std::string& method);
|
|
|
| - template<typename A1>
|
| + template <typename A1>
|
| void CallJS(const std::string& method, const A1& arg1) {
|
| web_ui()->CallJavascriptFunctionUnsafe(FullMethodPath(method),
|
| ::login::MakeValue(arg1));
|
| }
|
|
|
| - template<typename A1, typename A2>
|
| + template <typename A1, typename A2>
|
| void CallJS(const std::string& method, const A1& arg1, const A2& arg2) {
|
| web_ui()->CallJavascriptFunctionUnsafe(FullMethodPath(method),
|
| ::login::MakeValue(arg1),
|
| ::login::MakeValue(arg2));
|
| }
|
|
|
| - template<typename A1, typename A2, typename A3>
|
| + template <typename A1, typename A2, typename A3>
|
| void CallJS(const std::string& method,
|
| const A1& arg1,
|
| const A2& arg2,
|
| @@ -110,7 +109,7 @@ class BaseScreenHandler : public content::WebUIMessageHandler,
|
| ::login::MakeValue(arg2), ::login::MakeValue(arg3));
|
| }
|
|
|
| - template<typename A1, typename A2, typename A3, typename A4>
|
| + template <typename A1, typename A2, typename A3, typename A4>
|
| void CallJS(const std::string& method,
|
| const A1& arg1,
|
| const A2& arg2,
|
| @@ -123,15 +122,14 @@ class BaseScreenHandler : public content::WebUIMessageHandler,
|
| }
|
|
|
| // Shortcut methods for adding WebUI callbacks.
|
| - template<typename T>
|
| + template <typename T>
|
| void AddRawCallback(const std::string& name,
|
| void (T::*method)(const base::ListValue* args)) {
|
| web_ui()->RegisterMessageCallback(
|
| - name,
|
| - base::Bind(method, base::Unretained(static_cast<T*>(this))));
|
| + name, base::Bind(method, base::Unretained(static_cast<T*>(this))));
|
| }
|
|
|
| - template<typename T, typename... Args>
|
| + template <typename T, typename... Args>
|
| void AddCallback(const std::string& name, void (T::*method)(Args...)) {
|
| base::Callback<void(Args...)> callback =
|
| base::Bind(method, base::Unretained(static_cast<T*>(this)));
|
| @@ -197,9 +195,9 @@ class BaseScreenHandler : public content::WebUIMessageHandler,
|
| // Pending changes to context which will be sent when the page will be ready.
|
| base::DictionaryValue pending_context_changes_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(BaseScreenHandler);
|
| + DISALLOW_COPY_AND_ASSIGN(BaseWebUIHandler);
|
| };
|
|
|
| } // namespace chromeos
|
|
|
| -#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_H_
|
| +#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_WEBUI_HANDLER_H_
|
|
|