Home | History | Annotate | Download | only in chromeos
      1 // Copyright (c) 2011 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_CHANGE_PICTURE_OPTIONS_HANDLER_H_
      6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDLER_H_
      7 
      8 #include "chrome/browser/ui/shell_dialogs.h"
      9 #include "chrome/browser/ui/webui/options/options_ui.h"
     10 #include "ui/gfx/native_widget_types.h"
     11 
     12 class DictionaryValue;
     13 class ListValue;
     14 
     15 namespace chromeos {
     16 
     17 // ChromeOS user image options page UI handler.
     18 class ChangePictureOptionsHandler : public OptionsPageUIHandler,
     19                                     public SelectFileDialog::Listener {
     20  public:
     21   ChangePictureOptionsHandler();
     22   virtual ~ChangePictureOptionsHandler();
     23 
     24   // OptionsPageUIHandler implementation.
     25   virtual void GetLocalizedValues(DictionaryValue* localized_strings);
     26 
     27   // WebUIMessageHandler implementation.
     28   virtual void RegisterMessages();
     29 
     30  private:
     31   // Opens a file selection dialog to choose user image from file.
     32   void ChooseFile(const ListValue* args);
     33 
     34   // Opens the camera capture dialog.
     35   void TakePhoto(const ListValue* args);
     36 
     37   // Gets the list of available user images and sends it to the page.
     38   void GetAvailableImages(const ListValue* args);
     39 
     40   // Selects one of the available images as user's.
     41   void SelectImage(const ListValue* args);
     42 
     43   // SelectFileDialog::Delegate implementation.
     44   virtual void FileSelected(const FilePath& path, int index, void* params);
     45 
     46   // Returns handle to browser window or NULL if it can't be found.
     47   gfx::NativeWindow GetBrowserWindow() const;
     48 
     49   scoped_refptr<SelectFileDialog> select_file_dialog_;
     50 
     51   DISALLOW_COPY_AND_ASSIGN(ChangePictureOptionsHandler);
     52 };
     53 
     54 } // namespace chromeos
     55 
     56 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CHANGE_PICTURE_OPTIONS_HANDLER_H_
     57