Home | History | Annotate | Download | only in chromeos
      1 // Copyright 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.
      4 
      5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_SALSA_UI_H_
      6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_SALSA_UI_H_
      7 
      8 #include <map>
      9 
     10 #include "base/values.h"
     11 #include "chrome/browser/profiles/profile.h"
     12 #include "content/public/browser/web_ui_controller.h"
     13 
     14 namespace base {
     15 class ListValue;
     16 class Value;
     17 }  // namespace base
     18 
     19 // The WebUI for 'chrome://salsa' -- a user front end for the touch UI
     20 // blind user studies.  I does this by setting gesture preference values
     21 // without the user knowing which ones and having them try out various
     22 // settings to see which results in a better experience for them.
     23 class SalsaUI : public content::WebUIController {
     24  public:
     25   // Constructs a new GestureConfig for the specified |web_ui|.
     26   explicit SalsaUI(content::WebUI* web_ui);
     27   virtual ~SalsaUI();
     28 
     29  private:
     30   // Set a preference setting's value.
     31   // Two parameters are provided in a JS list: prefName and value, the
     32   // key of the preference value to be set, and the value it's to be set to.
     33   void SetPreferenceValue(const base::ListValue* args);
     34 
     35   // Record the current value for a preference key and store the key/value pair
     36   // in the member variable orig_values_.
     37   void BackupPreferenceValue(const base::ListValue* args);
     38 
     39   // Check and see if a key is on the whitelist.  Returns the index into
     40   // the whitelist on success and -1 on failure.
     41   int WhitelistIndex(const char* key) const;
     42 
     43   std::map<int, const base::Value*> orig_values_;
     44 
     45   DISALLOW_COPY_AND_ASSIGN(SalsaUI);
     46 };
     47 
     48 #endif  // CHROME_BROWSER_UI_WEBUI_CHROMEOS_SALSA_UI_H_
     49 
     50