| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CONTRO
LLER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CONTRO
LLER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CONTRO
LLER_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CONTRO
LLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 virtual content::WebContents* web_contents(); | 98 virtual content::WebContents* web_contents(); |
| 99 | 99 |
| 100 ui::MenuModel* GetContextMenu(MediaGalleryPrefId id); | 100 ui::MenuModel* GetContextMenu(MediaGalleryPrefId id); |
| 101 | 101 |
| 102 protected: | 102 protected: |
| 103 typedef base::Callback<MediaGalleriesScanResultDialog* ( | 103 typedef base::Callback<MediaGalleriesScanResultDialog* ( |
| 104 MediaGalleriesScanResultDialogController*)> CreateDialogCallback; | 104 MediaGalleriesScanResultDialogController*)> CreateDialogCallback; |
| 105 typedef std::map<MediaGalleryPrefId, ScanResult> ScanResults; | 105 typedef std::map<MediaGalleryPrefId, ScanResult> ScanResults; |
| 106 | 106 |
| 107 // Updates |results| from |preferences|. Will not add galleries from | 107 // Updates |scan_results| from |preferences|. Will not add galleries from |
| 108 // |ignore_list| onto |results|. | 108 // |ignore_list| onto |scan_results|. |
| 109 static void UpdateScanResultsFromPreferences( | 109 static void UpdateScanResultsFromPreferences( |
| 110 MediaGalleriesPreferences* preferences, | 110 MediaGalleriesPreferences* preferences, |
| 111 const extensions::Extension* extension, | 111 const extensions::Extension* extension, |
| 112 MediaGalleryPrefIdSet ignore_list, | 112 MediaGalleryPrefIdSet ignore_list, |
| 113 ScanResults* scan_results); | 113 ScanResults* scan_results); |
| 114 | 114 |
| 115 // Used for unit tests. | 115 // Used for unit tests. |
| 116 MediaGalleriesScanResultDialogController( | 116 MediaGalleriesScanResultDialogController( |
| 117 const extensions::Extension& extension, | 117 const extensions::Extension& extension, |
| 118 MediaGalleriesPreferences* preferences_, | 118 MediaGalleriesPreferences* preferences_, |
| 119 const CreateDialogCallback& create_dialog_callback, | 119 const CreateDialogCallback& create_dialog_callback, |
| 120 const base::Closure& on_finish); | 120 const base::Closure& on_finish); |
| 121 | 121 |
| 122 virtual ~MediaGalleriesScanResultDialogController(); | 122 virtual ~MediaGalleriesScanResultDialogController(); |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 friend class MediaGalleriesScanResultDialogControllerTest; | 125 friend class MediaGalleriesScanResultDialogControllerTest; |
| 126 friend class MediaGalleriesScanResultDialogCocoaTest; | 126 friend class MediaGalleriesScanResultDialogCocoaTest; |
| 127 | 127 |
| 128 // Bottom half of constructor -- called when |preferences_| is initialized. | 128 // Bottom half of constructor -- called when |preferences_| is initialized. |
| 129 void OnPreferencesInitialized(); | 129 void OnPreferencesInitialized(); |
| 130 | 130 |
| 131 // Used to keep the dialog in sync with the preferences. | 131 // Used to keep the dialog in sync with the preferences. |
| 132 void OnPreferenceUpdate(const std::string& extension_id, | 132 void OnPreferenceUpdate(const std::string& extension_id); |
| 133 MediaGalleryPrefId pref_id); | |
| 134 | 133 |
| 135 // Used to keep the dialog in sync with attached and detached devices. | 134 // Used to keep the dialog in sync with attached and detached devices. |
| 136 void OnRemovableDeviceUpdate(const std::string device_id); | 135 void OnRemovableDeviceUpdate(const std::string device_id); |
| 137 | 136 |
| 138 Profile* GetProfile() const; | 137 Profile* GetProfile() const; |
| 139 | 138 |
| 140 // RemovableStorageObserver implementation. | 139 // RemovableStorageObserver implementation. |
| 141 // Used to keep dialog in sync with removable device status. | 140 // Used to keep dialog in sync with removable device status. |
| 142 virtual void OnRemovableStorageAttached(const StorageInfo& info) OVERRIDE; | 141 virtual void OnRemovableStorageAttached(const StorageInfo& info) OVERRIDE; |
| 143 virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE; | 142 virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 183 |
| 185 // The view that's showing. | 184 // The view that's showing. |
| 186 scoped_ptr<MediaGalleriesScanResultDialog> dialog_; | 185 scoped_ptr<MediaGalleriesScanResultDialog> dialog_; |
| 187 | 186 |
| 188 scoped_ptr<MediaGalleryContextMenu> context_menu_; | 187 scoped_ptr<MediaGalleryContextMenu> context_menu_; |
| 189 | 188 |
| 190 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesScanResultDialogController); | 189 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesScanResultDialogController); |
| 191 }; | 190 }; |
| 192 | 191 |
| 193 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CON
TROLLER_H_ | 192 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CON
TROLLER_H_ |
| OLD | NEW |