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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/virtual_keyboard_manager_handler.h

Issue 9814030: get rid of old options pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_VIRTUAL_KEYBOARD_MANAGER_HANDLE R_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_VIRTUAL_KEYBOARD_MANAGER_HANDLE R_H_
7 #pragma once
8
9 #include <map>
10 #include <set>
11 #include <string>
12
13 #include "chrome/browser/ui/webui/options/options_ui.h"
14 #include "googleurl/src/gurl.h"
15
16 namespace base {
17 class DictionaryValue;
18 class ListValue;
19 } // namespace base
20
21 namespace chromeos {
22
23 namespace input_method {
24 class VirtualKeyboard;
25 } // namespace input_method;
26
27 // A class which provides information to virtual_keyboard.js.
28 class VirtualKeyboardManagerHandler : public OptionsPageUIHandler {
29 public:
30 VirtualKeyboardManagerHandler();
31 virtual ~VirtualKeyboardManagerHandler();
32
33 // OptionsPageUIHandler implementation.
34 virtual void GetLocalizedValues(
35 base::DictionaryValue* localized_strings) OVERRIDE;
36 virtual void RegisterMessages() OVERRIDE;
37
38 protected:
39 typedef std::multimap<
40 std::string, const input_method::VirtualKeyboard*> LayoutToKeyboard;
41 typedef std::map<GURL, const input_method::VirtualKeyboard*> UrlToKeyboard;
42
43 // Returns true if |layout_to_keyboard| contains |layout| as a key, and the
44 // value for |layout| contains |url|. This function is protected for
45 // testability.
46 static bool ValidateUrl(const UrlToKeyboard& url_to_keyboard,
47 const std::string& layout,
48 const std::string& url);
49
50 // Builds a list from |layout_to_keyboard| and |virtual_keyboard_user_pref|.
51 // See virtual_keyboard_list.js for an example of the format the list should
52 // take. This function is protected for testability.
53 static base::ListValue* CreateVirtualKeyboardList(
54 const LayoutToKeyboard& layout_to_keyboard,
55 const UrlToKeyboard& url_to_keyboard,
56 const base::DictionaryValue* virtual_keyboard_user_pref);
57
58 private:
59 // Reads user pref and create a list using CreateVirtualKeyboardList().
60 base::ListValue* GetVirtualKeyboardList();
61
62 // Handles chrome.send("updateVirtualKeyboardList") JS call.
63 // TODO(yusukes): This function should also be called when user pref is
64 // updated by chrome://settings page in other tab.
65 void UpdateVirtualKeyboardList(const base::ListValue* args);
66
67 // Handles chrome.send("setVirtualKeyboardPreference") JS call.
68 void SetVirtualKeyboardPreference(const base::ListValue* args);
69 // Handles chrome.send("clearVirtualKeyboardPreference") JS call.
70 void ClearVirtualKeyboardPreference(const base::ListValue* args);
71
72 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardManagerHandler);
73 };
74
75 } // namespace chromeos
76
77 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_VIRTUAL_KEYBOARD_MANAGER_HAN DLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698