#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"
namespace content {
class WebContents;
class Extension;
}
+namespace ui {
+class MenuModel;
+}
+
class MediaGalleriesScanResultDialogController;
+class MediaGalleryContextMenu;
class Profile;
// The view.
: pref_info(pref_info),
selected(selected) {
}
- ScanResult() {}
+ ScanResult() : selected(false) {}
MediaGalleryPrefInfo pref_info;
bool selected;
};
typedef std::vector<ScanResult> OrderedScanResults;
+ // |preferences| must be already initialized.
+ static size_t ScanResultCountForExtension(
+ MediaGalleriesPreferences* preferences,
+ const extensions::Extension* extension);
+
// The constructor creates a dialog controller which owns itself.
MediaGalleriesScanResultDialogController(
content::WebContents* web_contents,
virtual content::WebContents* web_contents();
- private:
- friend class MediaGalleriesScanResultDialogControllerTest;
+ ui::MenuModel* GetContextMenu(MediaGalleryPrefId id);
- typedef std::map<MediaGalleryPrefId, ScanResult> ScanResults;
+ protected:
typedef base::Callback<MediaGalleriesScanResultDialog* (
MediaGalleriesScanResultDialogController*)> CreateDialogCallback;
+ typedef std::map<MediaGalleryPrefId, ScanResult> ScanResults;
+
+ // Updates |scan_results| from |preferences|. Will not add galleries from
+ // |ignore_list| onto |scan_results|.
+ static void UpdateScanResultsFromPreferences(
+ MediaGalleriesPreferences* preferences,
+ const extensions::Extension* extension,
+ MediaGalleryPrefIdSet ignore_list,
+ ScanResults* scan_results);
// Used for unit tests.
MediaGalleriesScanResultDialogController(
virtual ~MediaGalleriesScanResultDialogController();
+ private:
+ friend class MediaGalleriesScanResultDialogControllerTest;
+ friend class MediaGalleriesScanResultDialogCocoaTest;
+
// Bottom half of constructor -- called when |preferences_| is initialized.
void OnPreferencesInitialized();
- // Update the controller state from preferences.
- void UpdateFromPreferences();
-
// Used to keep the dialog in sync with the preferences.
- void OnPreferenceUpdate(const std::string& extension_id,
- MediaGalleryPrefId pref_id);
+ void OnPreferenceUpdate(const std::string& extension_id);
// Used to keep the dialog in sync with attached and detached devices.
void OnRemovableDeviceUpdate(const std::string device_id);
// The view that's showing.
scoped_ptr<MediaGalleriesScanResultDialog> dialog_;
+ scoped_ptr<MediaGalleryContextMenu> context_menu_;
+
DISALLOW_COPY_AND_ASSIGN(MediaGalleriesScanResultDialogController);
};