Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / media_galleries_handler.h
blob35663443bbe393f562429920fad8cfbb76bfe6d3
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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/prefs/pref_change_registrar.h"
11 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
12 #include "chrome/browser/ui/webui/options/options_ui.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "ui/shell_dialogs/select_file_dialog.h"
16 namespace options {
18 // Handles messages related to adding or removing media galleries.
19 class MediaGalleriesHandler
20 : public OptionsPageUIHandler,
21 public ui::SelectFileDialog::Listener,
22 public MediaGalleriesPreferences::GalleryChangeObserver {
23 public:
24 MediaGalleriesHandler();
25 virtual ~MediaGalleriesHandler();
27 // OptionsPageUIHandler implementation.
28 virtual void GetLocalizedValues(base::DictionaryValue* values) OVERRIDE;
29 virtual void RegisterMessages() OVERRIDE;
31 // SelectFileDialog::Listener implementation.
32 virtual void FileSelected(const base::FilePath& path,
33 int index,
34 void* params) OVERRIDE;
36 // MediaGalleriesPreferences::GalleryChangeObserver overrides.
37 virtual void OnGalleryAdded(MediaGalleriesPreferences* pref,
38 MediaGalleryPrefId pref_id) OVERRIDE;
39 virtual void OnGalleryRemoved(MediaGalleriesPreferences* pref,
40 MediaGalleryPrefId pref_id) OVERRIDE;
41 virtual void OnGalleryInfoUpdated(MediaGalleriesPreferences* pref,
42 MediaGalleryPrefId pref_id) OVERRIDE;
44 private:
45 // Handles the "addNewGallery" message (no arguments).
46 void HandleAddNewGallery(const base::ListValue* args);
48 // Handles the "initializeMediaGalleries" message (no arguments).
49 void HandleInitializeMediaGalleries(const base::ListValue* args);
51 // Handles "forgetGallery" message. The first and only argument is the id of
52 // the gallery.
53 void HandleForgetGallery(const base::ListValue* args);
55 // Called when the list of known galleries has changed; updates the page.
56 void OnGalleriesChanged(MediaGalleriesPreferences* pref);
58 // Called when MediaGalleriesPreferences have been initialized.
59 void PreferencesInitialized();
61 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
63 base::WeakPtrFactory<MediaGalleriesHandler> weak_ptr_factory_;
65 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesHandler);
68 } // namespace options
70 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_