Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1365)

Unified Diff: chrome/browser/ui/webui/chromeos/login/base_screen_handler.h

Issue 755203002: Added usage of ScreenContext in EulaScreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comments. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
diff --git a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
index fbb6f64c1a45f5e298d8584e2bb9e496de79a975..83fa5e29b373692c936ceac11f23973699d4eb32 100644
--- a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
@@ -24,6 +24,8 @@ class Value;
namespace chromeos {
+class BaseScreen;
+
// Class that collects Localized Values for translation.
class LocalizedValuesBuilder {
public:
@@ -90,6 +92,9 @@ class BaseScreenHandler : public content::WebUIMessageHandler {
void GetLocalizedStrings(
base::DictionaryValue* localized_strings);
+ // WebUIMessageHandler implementation:
+ virtual void RegisterMessages() override;
+
// This method is called when page is ready. It propagates to inherited class
// via virtual Initialize() method (see below).
void InitializeBase();
@@ -105,6 +110,13 @@ class BaseScreenHandler : public content::WebUIMessageHandler {
// All subclasses should implement this method to provide localized values.
virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) = 0;
+ // All subclasses should implement this method to register callbacks for JS
+ // messages.
+ //
+ // TODO (ygorshenin, crbug.com/433797): make this method purely vrtual when
+ // all screens will be switched to use ScreenContext.
+ virtual void DeclareJSCallbacks() {}
+
// Subclasses can override these methods to pass additional parameters
// to loadTimeData. Generally, it is a bad approach, and it should be replaced
// with Context at some point.
@@ -221,14 +233,21 @@ class BaseScreenHandler : public content::WebUIMessageHandler {
// Returns the window which shows us.
virtual gfx::NativeWindow GetNativeWindow();
+ void set_base_screen(BaseScreen* base_screen) { base_screen_ = base_screen; }
+
private:
// Returns full name of JS method based on screen and method
// names.
std::string FullMethodPath(const std::string& method) const;
+ // Handles situation when screen context is changed.
+ void HandleContextChanged(const base::DictionaryValue* diff);
+
// Keeps whether page is ready.
bool page_is_ready_;
+ BaseScreen* base_screen_;
+
base::DictionaryValue* localized_values_;
// Full name of the corresponding JS screen object. Can be empty, if

Powered by Google App Engine
This is Rietveld 408576698