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

Side by Side Diff: extensions/browser/mojo/keep_alive_impl.h

Issue 2851173004: Eliminate bind callback that doesn't take a BindSourceInfo parameter. (Closed)
Patch Set: . Created 3 years, 7 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 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 EXTENSIONS_BROWSER_MOJO_KEEP_ALIVE_IMPL_H_ 5 #ifndef EXTENSIONS_BROWSER_MOJO_KEEP_ALIVE_IMPL_H_
6 #define EXTENSIONS_BROWSER_MOJO_KEEP_ALIVE_IMPL_H_ 6 #define EXTENSIONS_BROWSER_MOJO_KEEP_ALIVE_IMPL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/scoped_observer.h" 10 #include "base/scoped_observer.h"
11 #include "extensions/browser/extension_registry_observer.h" 11 #include "extensions/browser/extension_registry_observer.h"
12 #include "extensions/common/mojo/keep_alive.mojom.h" 12 #include "extensions/common/mojo/keep_alive.mojom.h"
13 #include "mojo/public/cpp/bindings/binding.h" 13 #include "mojo/public/cpp/bindings/binding.h"
14 #include "services/service_manager/public/cpp/bind_source_info.h"
14 15
15 namespace content { 16 namespace content {
16 class BrowserContext; 17 class BrowserContext;
17 } 18 }
18 19
19 namespace extensions { 20 namespace extensions {
20 class Extension; 21 class Extension;
21 22
22 // An RAII mojo service implementation for extension keep alives. This adds a 23 // An RAII mojo service implementation for extension keep alives. This adds a
23 // keep alive on construction and removes it on destruction. 24 // keep alive on construction and removes it on destruction.
24 class KeepAliveImpl : public KeepAlive, public ExtensionRegistryObserver { 25 class KeepAliveImpl : public KeepAlive, public ExtensionRegistryObserver {
25 public: 26 public:
26 // Create a keep alive for |extension| running in |context| and connect it to 27 // Create a keep alive for |extension| running in |context| and connect it to
27 // |request|. When the requester closes its pipe, the keep alive ends. 28 // |request|. When the requester closes its pipe, the keep alive ends.
28 static void Create(content::BrowserContext* context, 29 static void Create(content::BrowserContext* context,
29 const Extension* extension, 30 const Extension* extension,
31 const service_manager::BindSourceInfo& source_info,
30 KeepAliveRequest request); 32 KeepAliveRequest request);
31 33
32 private: 34 private:
33 KeepAliveImpl(content::BrowserContext* context, 35 KeepAliveImpl(content::BrowserContext* context,
34 const Extension* extension, 36 const Extension* extension,
35 KeepAliveRequest request); 37 KeepAliveRequest request);
36 ~KeepAliveImpl() override; 38 ~KeepAliveImpl() override;
37 39
38 // ExtensionRegistryObserver overrides. 40 // ExtensionRegistryObserver overrides.
39 void OnExtensionUnloaded(content::BrowserContext* browser_context, 41 void OnExtensionUnloaded(content::BrowserContext* browser_context,
40 const Extension* extension, 42 const Extension* extension,
41 UnloadedExtensionReason reason) override; 43 UnloadedExtensionReason reason) override;
42 void OnShutdown(ExtensionRegistry* registry) override; 44 void OnShutdown(ExtensionRegistry* registry) override;
43 45
44 // Invoked when the mojo connection is disconnected. 46 // Invoked when the mojo connection is disconnected.
45 void OnDisconnected(); 47 void OnDisconnected();
46 48
47 content::BrowserContext* context_; 49 content::BrowserContext* context_;
48 const Extension* extension_; 50 const Extension* extension_;
49 ScopedObserver<ExtensionRegistry, KeepAliveImpl> extension_registry_observer_; 51 ScopedObserver<ExtensionRegistry, KeepAliveImpl> extension_registry_observer_;
50 mojo::Binding<KeepAlive> binding_; 52 mojo::Binding<KeepAlive> binding_;
51 53
52 DISALLOW_COPY_AND_ASSIGN(KeepAliveImpl); 54 DISALLOW_COPY_AND_ASSIGN(KeepAliveImpl);
53 }; 55 };
54 56
55 } // namespace extensions 57 } // namespace extensions
56 58
57 #endif // EXTENSIONS_BROWSER_MOJO_KEEP_ALIVE_IMPL_H_ 59 #endif // EXTENSIONS_BROWSER_MOJO_KEEP_ALIVE_IMPL_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/mime_handler_private/mime_handler_private.cc ('k') | extensions/browser/mojo/keep_alive_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698