| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/prefs/public/pref_change_registrar.h" | 8 #include "base/prefs/public/pref_change_registrar.h" |
| 9 #include "base/prefs/public/pref_observer.h" | |
| 10 #include "chrome/browser/ui/webui/options/options_ui.h" | 9 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 11 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| 12 #include "ui/base/dialogs/select_file_dialog.h" | 11 #include "ui/base/dialogs/select_file_dialog.h" |
| 13 | 12 |
| 14 namespace options { | 13 namespace options { |
| 15 | 14 |
| 16 // Handles messages related to adding or removing media galleries. | 15 // Handles messages related to adding or removing media galleries. |
| 17 class MediaGalleriesHandler : public OptionsPageUIHandler, | 16 class MediaGalleriesHandler : public OptionsPageUIHandler, |
| 18 public PrefObserver, | |
| 19 public ui::SelectFileDialog::Listener { | 17 public ui::SelectFileDialog::Listener { |
| 20 public: | 18 public: |
| 21 MediaGalleriesHandler(); | 19 MediaGalleriesHandler(); |
| 22 virtual ~MediaGalleriesHandler(); | 20 virtual ~MediaGalleriesHandler(); |
| 23 | 21 |
| 24 // OptionsPageUIHandler implementation. | 22 // OptionsPageUIHandler implementation. |
| 25 virtual void GetLocalizedValues(base::DictionaryValue* values) OVERRIDE; | 23 virtual void GetLocalizedValues(base::DictionaryValue* values) OVERRIDE; |
| 26 virtual void InitializePage() OVERRIDE; | 24 virtual void InitializePage() OVERRIDE; |
| 27 virtual void RegisterMessages() OVERRIDE; | 25 virtual void RegisterMessages() OVERRIDE; |
| 28 | 26 |
| 29 // SelectFileDialog::Listener implementation. | 27 // SelectFileDialog::Listener implementation. |
| 30 virtual void FileSelected(const FilePath& path, int index, void* params) | 28 virtual void FileSelected(const FilePath& path, |
| 31 OVERRIDE; | 29 int index, |
| 32 | 30 void* params) OVERRIDE; |
| 33 // PrefObserver implementation. | |
| 34 virtual void OnPreferenceChanged(PrefServiceBase* service, | |
| 35 const std::string& pref_name) OVERRIDE; | |
| 36 | 31 |
| 37 private: | 32 private: |
| 38 // Handles the "addNewGallery" message (no arguments). | 33 // Handles the "addNewGallery" message (no arguments). |
| 39 void HandleAddNewGallery(const base::ListValue* args); | 34 void HandleAddNewGallery(const base::ListValue* args); |
| 40 // Handles "forgetGallery" message. The first and only argument is the id of | 35 // Handles "forgetGallery" message. The first and only argument is the id of |
| 41 // the gallery. | 36 // the gallery. |
| 42 void HandleForgetGallery(const base::ListValue* args); | 37 void HandleForgetGallery(const base::ListValue* args); |
| 43 | 38 |
| 44 // Called when the list of known galleries has changed; updates the page. | 39 // Called when the list of known galleries has changed; updates the page. |
| 45 void OnGalleriesChanged(); | 40 void OnGalleriesChanged(); |
| 46 | 41 |
| 47 PrefChangeRegistrar pref_change_registrar_; | 42 PrefChangeRegistrar pref_change_registrar_; |
| 48 | 43 |
| 49 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesHandler); | 44 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesHandler); |
| 50 }; | 45 }; |
| 51 | 46 |
| 52 } // namespace options | 47 } // namespace options |
| 53 | 48 |
| 54 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ | 49 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ |
| OLD | NEW |