Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: chrome/browser/extensions/api/media_galleries/media_galleries_api.h

Issue 174013009: Add end to end test for Media galleries scan API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mock Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/media_galleries/media_galleries_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Defines the Chrome Extensions Media Galleries API functions for accessing 5 // Defines the Chrome Extensions Media Galleries API functions for accessing
6 // user's media files, as specified in the extension API IDL. 6 // user's media files, as specified in the extension API IDL.
7 7
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_
9 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ 9 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback_forward.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" 17 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
17 #include "chrome/browser/extensions/chrome_extension_function.h" 18 #include "chrome/browser/extensions/chrome_extension_function.h"
18 #include "chrome/browser/media_galleries/media_file_system_registry.h" 19 #include "chrome/browser/media_galleries/media_file_system_registry.h"
19 #include "chrome/browser/media_galleries/media_scan_manager_observer.h" 20 #include "chrome/browser/media_galleries/media_scan_manager_observer.h"
20 #include "chrome/common/extensions/api/media_galleries.h" 21 #include "chrome/common/extensions/api/media_galleries.h"
21 #include "components/storage_monitor/media_storage_util.h" 22 #include "components/storage_monitor/media_storage_util.h"
22 23
23 namespace MediaGalleries = extensions::api::media_galleries; 24 namespace MediaGalleries = extensions::api::media_galleries;
24 25
26 class MediaGalleriesScanResultDialogController;
27
28 namespace content {
29 class WebContents;
30 }
31
25 namespace extensions { 32 namespace extensions {
26 33
34 class Extension;
35
27 // The profile-keyed service that manages the media galleries extension API. 36 // The profile-keyed service that manages the media galleries extension API.
28 // Created at the same time as the Profile. This is also the event router. 37 // Created at the same time as the Profile. This is also the event router.
29 class MediaGalleriesEventRouter : public ProfileKeyedAPI, 38 class MediaGalleriesEventRouter : public ProfileKeyedAPI,
30 public MediaScanManagerObserver { 39 public MediaScanManagerObserver {
31 public: 40 public:
32 // BrowserContextKeyedService implementation. 41 // BrowserContextKeyedService implementation.
33 virtual void Shutdown() OVERRIDE; 42 virtual void Shutdown() OVERRIDE;
34 43
35 // ProfileKeyedAPI implementation. 44 // ProfileKeyedAPI implementation.
36 static ProfileKeyedAPIFactory<MediaGalleriesEventRouter>* 45 static ProfileKeyedAPIFactory<MediaGalleriesEventRouter>*
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 class MediaGalleriesAddScanResultsFunction 207 class MediaGalleriesAddScanResultsFunction
199 : public ChromeAsyncExtensionFunction { 208 : public ChromeAsyncExtensionFunction {
200 public: 209 public:
201 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addScanResults", 210 DECLARE_EXTENSION_FUNCTION("mediaGalleries.addScanResults",
202 MEDIAGALLERIES_ADDSCANRESULTS) 211 MEDIAGALLERIES_ADDSCANRESULTS)
203 212
204 protected: 213 protected:
205 virtual ~MediaGalleriesAddScanResultsFunction(); 214 virtual ~MediaGalleriesAddScanResultsFunction();
206 virtual bool RunImpl() OVERRIDE; 215 virtual bool RunImpl() OVERRIDE;
207 216
217 // Pulled out for testing.
218 virtual MediaGalleriesScanResultDialogController* MakeDialog(
219 content::WebContents* web_contents,
220 const extensions::Extension& extension,
221 const base::Closure& on_finish);
222
208 private: 223 private:
209 // Bottom half for RunImpl, invoked after the preferences is initialized. 224 // Bottom half for RunImpl, invoked after the preferences is initialized.
210 void OnPreferencesInit(); 225 void OnPreferencesInit();
211 226
212 // Grabs galleries from the media file system registry and passes them to 227 // Grabs galleries from the media file system registry and passes them to
213 // ReturnGalleries(). 228 // ReturnGalleries().
214 void GetAndReturnGalleries(); 229 void GetAndReturnGalleries();
215 230
216 // Returns galleries to the caller. 231 // Returns galleries to the caller.
217 void ReturnGalleries(const std::vector<MediaFileSystemInfo>& filesystems); 232 void ReturnGalleries(const std::vector<MediaFileSystemInfo>& filesystems);
(...skipping 12 matching lines...) Expand all
230 // Bottom half for RunImpl, invoked after the preferences is initialized. 245 // Bottom half for RunImpl, invoked after the preferences is initialized.
231 void OnPreferencesInit(bool mime_type_only, const std::string& blob_uuid); 246 void OnPreferencesInit(bool mime_type_only, const std::string& blob_uuid);
232 247
233 void SniffMimeType(bool mime_type_only, scoped_ptr<std::string> blob_header, 248 void SniffMimeType(bool mime_type_only, scoped_ptr<std::string> blob_header,
234 int64 total_blob_length); 249 int64 total_blob_length);
235 }; 250 };
236 251
237 } // namespace extensions 252 } // namespace extensions
238 253
239 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ 254 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/media_galleries/media_galleries_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698