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

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

Issue 302573002: Add a Javascript wrapper around ServiceRegistry and expose it to WebUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@render-view-shell
Patch Set: address comments Created 6 years, 4 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
« no previous file with comments | « content/renderer/web_ui_mojo.cc ('k') | content/renderer/web_ui_mojo_context_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CONTEXT_STATE_H_ 5 #ifndef CONTENT_RENDERER_WEB_UI_MOJO_CONTEXT_STATE_H_
6 #define CONTENT_RENDERER_WEB_UI_MOJO_CONTEXT_STATE_H_ 6 #define CONTENT_RENDERER_WEB_UI_MOJO_CONTEXT_STATE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "gin/modules/module_registry_observer.h" 13 #include "gin/modules/module_registry_observer.h"
14 #include "mojo/public/cpp/system/core.h"
15 #include "v8/include/v8.h" 14 #include "v8/include/v8.h"
16 15
17 namespace blink { 16 namespace blink {
18 class WebFrame; 17 class WebFrame;
19 class WebURLResponse; 18 class WebURLResponse;
20 } 19 }
21 20
22 namespace gin { 21 namespace gin {
23 class ContextHolder; 22 class ContextHolder;
24 struct PendingModule; 23 struct PendingModule;
25 } 24 }
26 25
27 namespace content { 26 namespace content {
28 27
29 class ResourceFetcher; 28 class ResourceFetcher;
30 class WebUIRunner; 29 class WebUIRunner;
31 30
32 // WebUIMojoContextState manages the modules needed for mojo bindings. It does 31 // WebUIMojoContextState manages the modules needed for mojo bindings. It does
33 // this by way of gin. Non-builtin modules are downloaded by way of 32 // this by way of gin. Non-builtin modules are downloaded by way of
34 // ResourceFetchers. 33 // ResourceFetchers.
35 class WebUIMojoContextState : public gin::ModuleRegistryObserver { 34 class WebUIMojoContextState : public gin::ModuleRegistryObserver {
36 public: 35 public:
37 WebUIMojoContextState(blink::WebFrame* frame, 36 WebUIMojoContextState(blink::WebFrame* frame,
38 v8::Handle<v8::Context> context); 37 v8::Handle<v8::Context> context);
39 virtual ~WebUIMojoContextState(); 38 virtual ~WebUIMojoContextState();
40 39
41 // Called once the mojo::Handle is available. 40 void Run();
42 void SetHandle(mojo::ScopedMessagePipeHandle handle);
43 41
44 // Returns true if at least one module was added. 42 // Returns true if at least one module was added.
45 bool module_added() const { return module_added_; } 43 bool module_added() const { return module_added_; }
46 44
47 private: 45 private:
48 class Loader; 46 class Loader;
49 47
50 // Invokes FetchModule() for any modules that have not already been 48 // Invokes FetchModule() for any modules that have not already been
51 // downloaded. 49 // downloaded.
52 void FetchModules(const std::vector<std::string>& ids); 50 void FetchModules(const std::vector<std::string>& ids);
(...skipping 25 matching lines...) Expand all
78 76
79 // Set of modules we've fetched script from. 77 // Set of modules we've fetched script from.
80 std::set<std::string> fetched_modules_; 78 std::set<std::string> fetched_modules_;
81 79
82 DISALLOW_COPY_AND_ASSIGN(WebUIMojoContextState); 80 DISALLOW_COPY_AND_ASSIGN(WebUIMojoContextState);
83 }; 81 };
84 82
85 } // namespace content 83 } // namespace content
86 84
87 #endif // CONTENT_RENDERER_WEB_UI_MOJO_CONTEXT_STATE_H_ 85 #endif // CONTENT_RENDERER_WEB_UI_MOJO_CONTEXT_STATE_H_
OLDNEW
« no previous file with comments | « content/renderer/web_ui_mojo.cc ('k') | content/renderer/web_ui_mojo_context_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698