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

Side by Side Diff: content/renderer/mojo_bindings_controller.h

Issue 2049363003: Adds support for headless chrome embedder mojo services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes for Sami Created 4 years, 5 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 CONTENT_RENDERER_MOJO_BINDINGS_CONTROLLER_H_ 5 #ifndef CONTENT_RENDERER_MOJO_BINDINGS_CONTROLLER_H_
6 #define CONTENT_RENDERER_MOJO_BINDINGS_CONTROLLER_H_ 6 #define CONTENT_RENDERER_MOJO_BINDINGS_CONTROLLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "content/public/renderer/render_frame_observer.h" 11 #include "content/public/renderer/render_frame_observer.h"
12 #include "content/public/renderer/render_frame_observer_tracker.h" 12 #include "content/public/renderer/render_frame_observer_tracker.h"
13 #include "mojo/public/cpp/system/core.h" 13 #include "mojo/public/cpp/system/core.h"
14 14
15 namespace gin { 15 namespace gin {
16 class PerContextData; 16 class PerContextData;
17 } 17 }
18 18
19 namespace content { 19 namespace content {
20 20
21 class MojoContextState; 21 class MojoContextState;
22 22
23 enum class MojoBindingsType { FOR_UI_BINDINGS, FOR_LAYOUT_TESTS, FOR_HEADLESS };
Charlie Reis 2016/06/27 17:30:11 nit: s/FOR_UI_BINDINGS/FOR_WEB_UI/
alex clarke (OOO till 29th) 2016/07/29 09:06:23 Done.
24
23 // MojoBindingsController is responsible for enabling the renderer side of mojo 25 // MojoBindingsController is responsible for enabling the renderer side of mojo
24 // bindings. It creates (and destroys) a MojoContextState at the appropriate 26 // bindings. It creates (and destroys) a MojoContextState at the appropriate
25 // times and handles the necessary browser messages. MojoBindingsController 27 // times and handles the necessary browser messages. MojoBindingsController
26 // destroys itself when the RendererFrame it is created with is destroyed. 28 // destroys itself when the RendererFrame it is created with is destroyed.
27 class MojoBindingsController 29 class MojoBindingsController
28 : public RenderFrameObserver, 30 : public RenderFrameObserver,
29 public RenderFrameObserverTracker<MojoBindingsController> { 31 public RenderFrameObserverTracker<MojoBindingsController> {
30 public: 32 public:
31 MojoBindingsController(RenderFrame* render_frame, bool for_layout_tests); 33 MojoBindingsController(RenderFrame* render_frame,
34 MojoBindingsType bindings_type);
32 void RunScriptsAtDocumentStart(); 35 void RunScriptsAtDocumentStart();
33 void RunScriptsAtDocumentReady(); 36 void RunScriptsAtDocumentReady();
34 37
35 private: 38 private:
36 ~MojoBindingsController() override; 39 ~MojoBindingsController() override;
37 40
38 void CreateContextState(); 41 void CreateContextState();
39 void DestroyContextState(v8::Local<v8::Context> context); 42 void DestroyContextState(v8::Local<v8::Context> context);
40 MojoContextState* GetContextState(); 43 MojoContextState* GetContextState();
41 44
42 // RenderFrameObserver overrides: 45 // RenderFrameObserver overrides:
43 void WillReleaseScriptContext(v8::Local<v8::Context> context, 46 void WillReleaseScriptContext(v8::Local<v8::Context> context,
44 int world_id) override; 47 int world_id) override;
45 void DidClearWindowObject() override; 48 void DidClearWindowObject() override;
46 void OnDestruct() override; 49 void OnDestruct() override;
47 50
48 const bool for_layout_tests_; 51 const MojoBindingsType bindings_type_;
49 52
50 DISALLOW_COPY_AND_ASSIGN(MojoBindingsController); 53 DISALLOW_COPY_AND_ASSIGN(MojoBindingsController);
51 }; 54 };
52 55
53 } // namespace content 56 } // namespace content
54 57
55 #endif // CONTENT_RENDERER_MOJO_BINDINGS_CONTROLLER_H_ 58 #endif // CONTENT_RENDERER_MOJO_BINDINGS_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698