| OLD | NEW |
| (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_SET_WALLPAPER_OPTIONS_HANDLER_H
_ | |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDLER_H
_ | |
| 7 | |
| 8 #include "ash/desktop_background/desktop_background_resources.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "chrome/browser/ui/webui/options/options_ui.h" | |
| 11 #include "ui/base/dialogs/select_file_dialog.h" | |
| 12 #include "ui/gfx/native_widget_types.h" | |
| 13 | |
| 14 namespace base { | |
| 15 class DictionaryValue; | |
| 16 class ListValue; | |
| 17 } | |
| 18 | |
| 19 namespace chromeos { | |
| 20 | |
| 21 class WallpaperDelegate { | |
| 22 public: | |
| 23 // Call javascript function to add/update custom wallpaper thumbnail in | |
| 24 // picker UI. | |
| 25 virtual void SetCustomWallpaperThumbnail() = 0; | |
| 26 | |
| 27 protected: | |
| 28 virtual ~WallpaperDelegate() {} | |
| 29 }; | |
| 30 | |
| 31 namespace options { | |
| 32 | |
| 33 // ChromeOS user image options page UI handler. | |
| 34 class SetWallpaperOptionsHandler : public ::options::OptionsPageUIHandler, | |
| 35 public ui::SelectFileDialog::Listener, | |
| 36 public WallpaperDelegate { | |
| 37 public: | |
| 38 SetWallpaperOptionsHandler(); | |
| 39 virtual ~SetWallpaperOptionsHandler(); | |
| 40 | |
| 41 // OptionsPageUIHandler implementation. | |
| 42 virtual void GetLocalizedValues( | |
| 43 base::DictionaryValue* localized_strings) OVERRIDE; | |
| 44 | |
| 45 // WebUIMessageHandler implementation. | |
| 46 virtual void RegisterMessages() OVERRIDE; | |
| 47 | |
| 48 // WallpaperDelegate implementation. | |
| 49 virtual void SetCustomWallpaperThumbnail() OVERRIDE; | |
| 50 | |
| 51 private: | |
| 52 // SelectFileDialog::Delegate implementation. | |
| 53 virtual void FileSelected(const FilePath& path, int index, | |
| 54 void* params) OVERRIDE; | |
| 55 | |
| 56 // Sends list of available default images to the page. | |
| 57 void SendDefaultImages(); | |
| 58 | |
| 59 // Sends layout options for custom wallpaper. Only exposes CENTER, | |
| 60 // CENTER_CROPPED, STRETCH to users. Set the selected option to specified | |
| 61 // |layout|. | |
| 62 void SendLayoutOptions(ash::WallpaperLayout layout); | |
| 63 | |
| 64 // Handles page initialized event. | |
| 65 void HandlePageInitialized(const base::ListValue* args); | |
| 66 | |
| 67 // Handles page shown event. | |
| 68 void HandlePageShown(const base::ListValue* args); | |
| 69 | |
| 70 // Opens a file selection dialog to choose user image from file. | |
| 71 void HandleChooseFile(const base::ListValue* args); | |
| 72 | |
| 73 // Redraws the wallpaper with specified wallpaper layout. | |
| 74 void HandleLayoutChanged(const base::ListValue* args); | |
| 75 | |
| 76 // Selects one of the available default wallpapers. | |
| 77 void HandleDefaultWallpaper(const base::ListValue* args); | |
| 78 | |
| 79 // Sets user wallpaper to the next one in the list of default wallpapers. | |
| 80 void HandleDailyWallpaper(const base::ListValue* args); | |
| 81 | |
| 82 // Returns handle to browser window or NULL if it can't be found. | |
| 83 gfx::NativeWindow GetBrowserWindow() const; | |
| 84 | |
| 85 // Shows a dialog box for selecting a file. | |
| 86 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | |
| 87 | |
| 88 base::WeakPtrFactory<SetWallpaperOptionsHandler> weak_factory_; | |
| 89 | |
| 90 DISALLOW_COPY_AND_ASSIGN(SetWallpaperOptionsHandler); | |
| 91 }; | |
| 92 | |
| 93 } // namespace options | |
| 94 } // namespace chromeos | |
| 95 | |
| 96 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_SET_WALLPAPER_OPTIONS_HANDLE
R_H_ | |
| OLD | NEW |