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

Side by Side Diff: chrome/browser/extensions/api/streams_private/streams_private_api.h

Issue 797183005: Add a mimeHandler extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@streams-lifetime
Patch Set: Created 5 years, 11 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
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 #ifndef CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const base::Closure& callback); 51 const base::Closure& callback);
52 52
53 // BrowserContextKeyedAPI implementation. 53 // BrowserContextKeyedAPI implementation.
54 static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance(); 54 static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance();
55 55
56 private: 56 private:
57 friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>; 57 friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>;
58 typedef std::map<std::string, 58 typedef std::map<std::string,
59 std::map<GURL, 59 std::map<GURL,
60 linked_ptr<content::StreamHandle> > > StreamMap; 60 linked_ptr<content::StreamHandle> > > StreamMap;
61 using MimeHandlerStreamMap =
62 std::map<std::string,
63 std::map<GURL, std::pair<content::WebContents*, std::string>>>;
64 61
65 // ExtensionRegistryObserver implementation. 62 // ExtensionRegistryObserver implementation.
66 void OnExtensionUnloaded(content::BrowserContext* browser_context, 63 void OnExtensionUnloaded(content::BrowserContext* browser_context,
67 const Extension* extension, 64 const Extension* extension,
68 UnloadedExtensionInfo::Reason reason) override; 65 UnloadedExtensionInfo::Reason reason) override;
69 66
70 // BrowserContextKeyedAPI implementation. 67 // BrowserContextKeyedAPI implementation.
71 static const char* service_name() { 68 static const char* service_name() {
72 return "StreamsPrivateAPI"; 69 return "StreamsPrivateAPI";
73 } 70 }
74 static const bool kServiceIsNULLWhileTesting = true; 71 static const bool kServiceIsNULLWhileTesting = true;
75 static const bool kServiceRedirectedInIncognito = true; 72 static const bool kServiceRedirectedInIncognito = true;
76 73
77 content::BrowserContext* const browser_context_; 74 content::BrowserContext* const browser_context_;
78 StreamMap streams_; 75 StreamMap streams_;
79 76
80 // The streams whose lifetimes are managed by MimeHandlerViewGuest.
81 MimeHandlerStreamMap mime_handler_streams_;
82
83 // Listen to extension unloaded notifications. 77 // Listen to extension unloaded notifications.
84 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 78 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
85 extension_registry_observer_; 79 extension_registry_observer_;
86 80
87 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_; 81 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_;
88 82
89 }; 83 };
90 84
91 class StreamsPrivateAbortFunction : public UIThreadExtensionFunction { 85 class StreamsPrivateAbortFunction : public UIThreadExtensionFunction {
92 public: 86 public:
93 StreamsPrivateAbortFunction(); 87 StreamsPrivateAbortFunction();
94 DECLARE_EXTENSION_FUNCTION("streamsPrivate.abort", STREAMSPRIVATE_ABORT) 88 DECLARE_EXTENSION_FUNCTION("streamsPrivate.abort", STREAMSPRIVATE_ABORT)
95 89
96 protected: 90 protected:
97 ~StreamsPrivateAbortFunction() override {} 91 ~StreamsPrivateAbortFunction() override {}
98 92
99 // ExtensionFunction: 93 // ExtensionFunction:
100 ExtensionFunction::ResponseAction Run() override; 94 ExtensionFunction::ResponseAction Run() override;
101 95
102 private: 96 private:
103 void OnClose(); 97 void OnClose();
104 98
105 std::string stream_url_; 99 std::string stream_url_;
106 }; 100 };
107 101
108 } // namespace extensions 102 } // namespace extensions
109 103
110 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ 104 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698