#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
#include "chrome/browser/media_galleries/media_galleries_preferences.h"
-#include "chrome/browser/storage_monitor/removable_storage_observer.h"
+#include "components/storage_monitor/removable_storage_observer.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/shell_dialogs/select_file_dialog.h"
class MenuModel;
}
-class GalleryContextMenuModel;
class MediaGalleriesDialogController;
+class MediaGalleryContextMenu;
class Profile;
// The view.
virtual content::WebContents* web_contents();
- ui::MenuModel* GetContextMenuModel(MediaGalleryPrefId id);
+ ui::MenuModel* GetContextMenu(MediaGalleryPrefId id);
protected:
+ friend class MediaGalleriesDialogControllerTest;
+
+ typedef base::Callback<MediaGalleriesDialog* (
+ MediaGalleriesDialogController*)> CreateDialogCallback;
+
// For use with tests.
- explicit MediaGalleriesDialogController(
- const extensions::Extension& extension);
+ MediaGalleriesDialogController(
+ const extensions::Extension& extension,
+ MediaGalleriesPreferences* preferences,
+ const CreateDialogCallback& create_dialog_callback,
+ const base::Closure& on_finish);
virtual ~MediaGalleriesDialogController();
// galleries.
void InitializePermissions();
- // Saves state of |known_galleries_| and |new_galleries_| to model.
+ // Saves state of |known_galleries_|, |new_galleries_| and
+ // |forgotten_gallery_ids_| to model.
+ //
+ // NOTE: possible states for a gallery:
+ // K N F (K = Known, N = New, F = Forgotten)
+ // +---+---+---+
+ // | Y | N | N |
+ // +---+---+---+
+ // | N | Y | N |
+ // +---+---+---+
+ // | Y | N | Y |
+ // +---+---+---+
void SavePermissions();
// Updates the model and view when |preferences_| changes. Some of the
// never overlap with |known_galleries_|.
GalleryPermissionsVector new_galleries_;
+ // Galleries in |known_galleries_| that the user has forgotten.
+ MediaGalleryPrefIdSet forgotten_gallery_ids_;
+
// Callback to run when the dialog closes.
base::Closure on_finish_;
scoped_refptr<ui::SelectFileDialog> select_folder_dialog_;
- scoped_ptr<ui::MenuModel> context_menu_model_;
- scoped_ptr<GalleryContextMenuModel> gallery_menu_model_;
+ scoped_ptr<MediaGalleryContextMenu> context_menu_;
+
+ // Creates the dialog. Only changed for unit tests.
+ CreateDialogCallback create_dialog_callback_;
DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogController);
};