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

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

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 9 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
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/callback_forward.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
18 #include "chrome/browser/extensions/chrome_extension_function.h" 17 #include "chrome/browser/extensions/chrome_extension_function.h"
19 #include "chrome/browser/media_galleries/media_file_system_registry.h" 18 #include "chrome/browser/media_galleries/media_file_system_registry.h"
20 #include "chrome/browser/media_galleries/media_scan_manager_observer.h" 19 #include "chrome/browser/media_galleries/media_scan_manager_observer.h"
21 #include "chrome/common/extensions/api/media_galleries.h" 20 #include "chrome/common/extensions/api/media_galleries.h"
22 #include "components/storage_monitor/media_storage_util.h" 21 #include "components/storage_monitor/media_storage_util.h"
22 #include "extensions/browser/browser_context_keyed_api_factory.h"
23 23
24 namespace MediaGalleries = extensions::api::media_galleries; 24 namespace MediaGalleries = extensions::api::media_galleries;
25 25
26 class MediaGalleriesScanResultDialogController; 26 class MediaGalleriesScanResultDialogController;
27 27
28 namespace content { 28 namespace content {
29 class WebContents; 29 class WebContents;
30 } 30 }
31 31
32 namespace metadata { 32 namespace metadata {
33 class SafeMediaMetadataParser; 33 class SafeMediaMetadataParser;
34 } 34 }
35 35
36 namespace extensions { 36 namespace extensions {
37 37
38 class Extension; 38 class Extension;
39 39
40 // The profile-keyed service that manages the media galleries extension API. 40 // The profile-keyed service that manages the media galleries extension API.
41 // Created at the same time as the Profile. This is also the event router. 41 // Created at the same time as the Profile. This is also the event router.
42 class MediaGalleriesEventRouter : public ProfileKeyedAPI, 42 class MediaGalleriesEventRouter : public BrowserContextKeyedAPI,
43 public MediaScanManagerObserver { 43 public MediaScanManagerObserver {
44 public: 44 public:
45 // BrowserContextKeyedService implementation. 45 // BrowserContextKeyedService implementation.
46 virtual void Shutdown() OVERRIDE; 46 virtual void Shutdown() OVERRIDE;
47 47
48 // ProfileKeyedAPI implementation. 48 // BrowserContextKeyedAPI implementation.
49 static ProfileKeyedAPIFactory<MediaGalleriesEventRouter>* 49 static BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>*
50 GetFactoryInstance(); 50 GetFactoryInstance();
51 51
52 // Convenience method to get the MediaGalleriesAPI for a profile. 52 // Convenience method to get the MediaGalleriesAPI for a profile.
53 static MediaGalleriesEventRouter* Get(content::BrowserContext* context); 53 static MediaGalleriesEventRouter* Get(content::BrowserContext* context);
54 54
55 bool ExtensionHasScanProgressListener(const std::string& extension_id) const; 55 bool ExtensionHasScanProgressListener(const std::string& extension_id) const;
56 56
57 // MediaScanManagerObserver implementation. 57 // MediaScanManagerObserver implementation.
58 virtual void OnScanStarted(const std::string& extension_id) OVERRIDE; 58 virtual void OnScanStarted(const std::string& extension_id) OVERRIDE;
59 virtual void OnScanCancelled(const std::string& extension_id) OVERRIDE; 59 virtual void OnScanCancelled(const std::string& extension_id) OVERRIDE;
60 virtual void OnScanFinished( 60 virtual void OnScanFinished(
61 const std::string& extension_id, 61 const std::string& extension_id,
62 int gallery_count, 62 int gallery_count,
63 const MediaGalleryScanResult& file_counts) OVERRIDE; 63 const MediaGalleryScanResult& file_counts) OVERRIDE;
64 virtual void OnScanError(const std::string& extension_id) OVERRIDE; 64 virtual void OnScanError(const std::string& extension_id) OVERRIDE;
65 65
66 private: 66 private:
67 friend class ProfileKeyedAPIFactory<MediaGalleriesEventRouter>; 67 friend class BrowserContextKeyedAPIFactory<MediaGalleriesEventRouter>;
68 68
69 void DispatchEventToExtension(const std::string& extension_id, 69 void DispatchEventToExtension(const std::string& extension_id,
70 const std::string& event_name, 70 const std::string& event_name,
71 scoped_ptr<base::ListValue> event_args); 71 scoped_ptr<base::ListValue> event_args);
72 72
73 explicit MediaGalleriesEventRouter(content::BrowserContext* context); 73 explicit MediaGalleriesEventRouter(content::BrowserContext* context);
74 virtual ~MediaGalleriesEventRouter(); 74 virtual ~MediaGalleriesEventRouter();
75 75
76 // ProfileKeyedAPI implementation. 76 // BrowserContextKeyedAPI implementation.
77 static const char* service_name() { 77 static const char* service_name() {
78 return "MediaGalleriesAPI"; 78 return "MediaGalleriesAPI";
79 } 79 }
80 static const bool kServiceIsNULLWhileTesting = true; 80 static const bool kServiceIsNULLWhileTesting = true;
81 81
82 // Current profile. 82 // Current profile.
83 Profile* profile_; 83 Profile* profile_;
84 84
85 base::WeakPtrFactory<MediaGalleriesEventRouter> weak_ptr_factory_; 85 base::WeakPtrFactory<MediaGalleriesEventRouter> weak_ptr_factory_;
86 86
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 scoped_ptr<std::string> blob_header, 255 scoped_ptr<std::string> blob_header,
256 int64 total_blob_length); 256 int64 total_blob_length);
257 257
258 void OnSafeMediaMetadataParserDone( 258 void OnSafeMediaMetadataParserDone(
259 bool parse_success, base::DictionaryValue* metadata_dictionary); 259 bool parse_success, base::DictionaryValue* metadata_dictionary);
260 }; 260 };
261 261
262 } // namespace extensions 262 } // namespace extensions
263 263
264 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_ 264 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_MEDIA_GALLERIES_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/mdns/mdns_api.cc ('k') | 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