1d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 2d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)// found in the LICENSE file. 4d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 5d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_CHARGER_REPLACEMENT_HANDLER_H_ 6d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CHARGER_REPLACEMENT_HANDLER_H_ 7d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 8d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)#include "base/compiler_specific.h" 9d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)#include "content/public/browser/web_ui_message_handler.h" 10d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)#include "ui/gfx/native_widget_types.h" 11d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 12d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)class PrefRegistrySimple; 13d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 14d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)namespace chromeos { 15d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 16d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)class ChargerReplacementDialog; 17d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 18d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)// Handler for spring charger replacement web ui. 19d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)class ChargerReplacementHandler : public content::WebUIMessageHandler { 20d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) public: 21d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) enum SpringChargerStatus { 22d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) CHARGER_UNKNOWN, 23d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) CONFIRM_SAFE_CHARGER, 24d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) CONFIRM_NOT_ORDER_NEW_CHARGER, 25d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) CONFIRM_NEW_CHARGER_ORDERED_ONLINE, 26d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) CONFIRM_ORDER_NEW_CHARGER_BY_PHONE, 27d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) USE_BAD_CHARGER_AFTER_ORDER_ONLINE, 28d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) USE_BAD_CHARGER_AFTER_ORDER_BY_PHONE, 29d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) }; 30d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 31d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) explicit ChargerReplacementHandler(ChargerReplacementDialog* dialog); 32d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) virtual ~ChargerReplacementHandler(); 33d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 34d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) // Registers preferences. 35d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) static void RegisterPrefs(PrefRegistrySimple* registry); 36d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 37d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) // Sets/Gets charger status pref. 38d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) static SpringChargerStatus GetChargerStatusPref(); 39d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) static void SetChargerStatusPref(SpringChargerStatus status); 40d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 41d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) // WebUIMessageHandler overrides: 42d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) virtual void RegisterMessages() OVERRIDE; 43d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 44d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) // Gets localized strings for web ui. 45d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) static void GetLocalizedValues(base::DictionaryValue* localized_strings); 46d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 47d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) void set_charger_window(gfx::NativeWindow window) { 48d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) charger_window_ = window; 49d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) } 50d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 51d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) private: 52d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) void ConfirmSafeCharger(const base::ListValue* args); 53d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) void ConfirmNotOrderNewCharger(const base::ListValue* args); 54d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) void ConfirmChargerOrderedOnline(const base::ListValue* args); 55d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) void ConfirmChargerOrderByPhone(const base::ListValue* args); 56d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) void ConfirmStillUseBadCharger(const base::ListValue* args); 57d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) void ShowLink(const base::ListValue* args); 58d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 59d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) gfx::NativeWindow charger_window_; 60d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) ChargerReplacementDialog* dialog_; 61d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 62d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(ChargerReplacementHandler); 63d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)}; 64d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 65d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)} // namespace chromeos 66d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) 67d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CHARGER_REPLACEMENT_HANDLER_H_ 68