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

Unified Diff: chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h

Issue 1961183002: MD Settings: Update some Settings handlers to use new JS lifecycle management. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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/settings/chromeos/device_keyboard_handler.h
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h b/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h
index 55d02ac0a72fc1bcdb5a686c3469535b2122f4bc..15abad65e83ef8a2a30875c145fcf6c298a65153 100644
--- a/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h
+++ b/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DEVICE_KEYBOARD_HANDLER_H_
#include "base/macros.h"
+#include "base/scoped_observer.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "ui/events/devices/input_device_event_observer.h"
@@ -17,6 +18,10 @@ namespace content {
class WebUI;
}
+namespace ui {
+class DeviceDataManager;
+}
+
class Profile;
namespace chromeos {
@@ -32,6 +37,8 @@ class KeyboardHandler
// SettingsPageUIHandler implementation.
void RegisterMessages() override;
+ void OnJavascriptAllowed() override;
+ void OnJavascriptDisallowed() override;
michaelpg 2016/05/11 17:31:21 if Allowed has been called, will Disallowed always
tommycli 2016/05/11 17:32:44 No. I wish I could make it always be called, but
Dan Beam 2016/05/11 17:33:48 not currently. thought it *might* if we start to
Dan Beam 2016/05/11 17:34:06 though it might*
// ui::InputDeviceEventObserver implementation.
void OnKeyboardDeviceConfigurationChanged() override;
@@ -45,10 +52,12 @@ class KeyboardHandler
// Shows or hides the Caps Lock and Diamond key settings based on whether the
// system status.
- void UpdateShowKeys() const;
+ void UpdateShowKeys();
Profile* profile_; // Weak pointer.
+ ScopedObserver<ui::DeviceDataManager, KeyboardHandler> observer_;
michaelpg 2016/05/11 17:31:21 the OnJavascriptAllowed/Disallowed stuff is great.
tommycli 2016/05/11 17:32:44 The only reason I had to change it: OnJavascriptDi
tommycli 2016/05/11 17:35:20 (If I don't have a ScopedObserver, since OnJavascr
Dan Beam 2016/05/11 17:35:22 this sugar is less error-prone as well
+
DISALLOW_COPY_AND_ASSIGN(KeyboardHandler);
};

Powered by Google App Engine
This is Rietveld 408576698