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

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

Issue 215373004: Makes mojo WebUI run main only after page finishes loading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename DidFinishDocumentLoad so it doesn't conflict with RVO Created 6 years, 8 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"
(...skipping 24 matching lines...) Expand all
35 35
36 private: 36 private:
37 class MainFrameObserver : public RenderFrameObserver { 37 class MainFrameObserver : public RenderFrameObserver {
38 public: 38 public:
39 explicit MainFrameObserver(WebUIMojo* web_ui_mojo); 39 explicit MainFrameObserver(WebUIMojo* web_ui_mojo);
40 virtual ~MainFrameObserver(); 40 virtual ~MainFrameObserver();
41 41
42 // RenderFrameObserver overrides: 42 // RenderFrameObserver overrides:
43 virtual void WillReleaseScriptContext(v8::Handle<v8::Context> context, 43 virtual void WillReleaseScriptContext(v8::Handle<v8::Context> context,
44 int world_id) OVERRIDE; 44 int world_id) OVERRIDE;
45 virtual void DidFinishDocumentLoad() OVERRIDE;
45 46
46 private: 47 private:
47 WebUIMojo* web_ui_mojo_; 48 WebUIMojo* web_ui_mojo_;
48 49
49 DISALLOW_COPY_AND_ASSIGN(MainFrameObserver); 50 DISALLOW_COPY_AND_ASSIGN(MainFrameObserver);
50 }; 51 };
51 52
52 virtual ~WebUIMojo(); 53 virtual ~WebUIMojo();
53 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
58 // Invoked when the frame finishes loading. Invokes SetHandleOnContextState()
59 // if necessary.
60 void OnDidFinishDocumentLoad();
61
62 // Invokes SetHandle() on the WebUIMojoContextState (if there is one).
63 void SetHandleOnContextState(mojo::ScopedMessagePipeHandle handle);
64
57 WebUIMojoContextState* GetContextState(); 65 WebUIMojoContextState* GetContextState();
58 66
59 // RenderViewObserver overrides: 67 // RenderViewObserver overrides:
60 virtual void DidClearWindowObject(blink::WebFrame* frame, 68 virtual void DidClearWindowObject(blink::WebFrame* frame,
61 int world_id) OVERRIDE; 69 int world_id) OVERRIDE;
62 70
63 MainFrameObserver main_frame_observer_; 71 MainFrameObserver main_frame_observer_;
64 72
73 // Set to true in DidFinishDocumentLoad(). 'main' is only executed once this
74 // happens.
75 bool did_finish_document_load_;
76
77 // If SetBrowserHandle() is invoked before the document finishes loading the
78 // MessagePipeHandle is stored here. When the document finishes loading
79 // SetHandleOnContextState() is invoked to send the handle to the
80 // WebUIMojoContextState and ultimately the page.
81 mojo::ScopedMessagePipeHandle pending_handle_;
82
65 DISALLOW_COPY_AND_ASSIGN(WebUIMojo); 83 DISALLOW_COPY_AND_ASSIGN(WebUIMojo);
66 }; 84 };
67 85
68 } // namespace content 86 } // namespace content
69 87
70 #endif // CONTENT_RENDERER_WEB_UI_MOJO_H_ 88 #endif // CONTENT_RENDERER_WEB_UI_MOJO_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_mojo_impl.h ('k') | content/renderer/web_ui_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698