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