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

Side by Side Diff: trunk/src/content/renderer/web_ui_mojo.h

Issue 208263008: Revert 258763 "Adds plumbing to pass WebUI mojo::Handle from bro..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 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_WEB_UI_MOJO_H_ 5 #ifndef CONTENT_RENDERER_WEB_UI_MOJO_H_
6 #define CONTENT_RENDERER_WEB_UI_MOJO_H_ 6 #define CONTENT_RENDERER_WEB_UI_MOJO_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "content/public/renderer/render_frame_observer.h" 10 #include "content/public/renderer/render_frame_observer.h"
11 #include "content/public/renderer/render_view_observer.h" 11 #include "content/public/renderer/render_view_observer.h"
12 #include "content/public/renderer/render_view_observer_tracker.h" 12 #include "content/public/renderer/render_view_observer_tracker.h"
13 #include "mojo/public/system/core_cpp.h" 13 #include "mojo/public/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 WebUIMojoContextState; 21 class WebUIMojoContextState;
22 22
23 // WebUIMojo is responsible for enabling the renderer side of mojo bindings. 23 // WebUIMojo is responsible for enabling the renderer side of mojo bindings.
24 // It creates (and destroys) a WebUIMojoContextState at the appropriate times 24 // It creates (and destroys) a WebUIMojoContextState at the appropriate times
25 // and handles the necessary browser messages. WebUIMojo destroys itself when 25 // and handles the necessary browser messages. WebUIMojo destroys itself when
26 // the RendererView it is created with is destroyed. 26 // the RendererView it is created with is destroyed.
27 class WebUIMojo 27 class WebUIMojo
28 : public RenderViewObserver, 28 : public RenderViewObserver,
29 public RenderViewObserverTracker<WebUIMojo> { 29 public RenderViewObserverTracker<WebUIMojo> {
30 public: 30 public:
31 explicit WebUIMojo(RenderView* render_view); 31 explicit WebUIMojo(RenderView* render_view);
32 32
33 // Sets the handle to the current WebUI.
34 void SetBrowserHandle(mojo::ScopedMessagePipeHandle handle);
35
36 private: 33 private:
37 class MainFrameObserver : public RenderFrameObserver { 34 class MainFrameObserver : public RenderFrameObserver {
38 public: 35 public:
39 explicit MainFrameObserver(WebUIMojo* web_ui_mojo); 36 explicit MainFrameObserver(WebUIMojo* web_ui_mojo);
40 virtual ~MainFrameObserver(); 37 virtual ~MainFrameObserver();
41 38
42 // RenderFrameObserver overrides: 39 // RenderFrameObserver overrides:
43 virtual void WillReleaseScriptContext(v8::Handle<v8::Context> context, 40 virtual void WillReleaseScriptContext(v8::Handle<v8::Context> context,
44 int world_id) OVERRIDE; 41 int world_id) OVERRIDE;
45 42
46 private: 43 private:
47 WebUIMojo* web_ui_mojo_; 44 WebUIMojo* web_ui_mojo_;
48 45
49 DISALLOW_COPY_AND_ASSIGN(MainFrameObserver); 46 DISALLOW_COPY_AND_ASSIGN(MainFrameObserver);
50 }; 47 };
51 48
52 virtual ~WebUIMojo(); 49 virtual ~WebUIMojo();
53 50
51 // Invoked from ViewMsg_SetBrowserHandle. Passes handle to current
52 // MojoWebUIContextState.
53 void OnSetBrowserHandle(MojoHandle handle);
54
54 void CreateContextState(); 55 void CreateContextState();
55 void DestroyContextState(v8::Handle<v8::Context> context); 56 void DestroyContextState(v8::Handle<v8::Context> context);
56 57
57 WebUIMojoContextState* GetContextState(); 58 WebUIMojoContextState* GetContextState();
58 59
59 // RenderViewObserver overrides: 60 // RenderViewObserver overrides:
60 virtual void DidClearWindowObject(blink::WebFrame* frame, 61 virtual void DidClearWindowObject(blink::WebFrame* frame,
61 int world_id) OVERRIDE; 62 int world_id) OVERRIDE;
62 63
63 MainFrameObserver main_frame_observer_; 64 MainFrameObserver main_frame_observer_;
64 65
65 DISALLOW_COPY_AND_ASSIGN(WebUIMojo); 66 DISALLOW_COPY_AND_ASSIGN(WebUIMojo);
66 }; 67 };
67 68
68 } // namespace content 69 } // namespace content
69 70
70 #endif // CONTENT_RENDERER_WEB_UI_MOJO_H_ 71 #endif // CONTENT_RENDERER_WEB_UI_MOJO_H_
OLDNEW
« no previous file with comments | « trunk/src/content/renderer/render_view_impl.cc ('k') | trunk/src/content/renderer/web_ui_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698