Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" | 14 #include "mojo/public/cpp/system/core.h" |
|
sky
2014/06/26 17:03:52
nit: I think you can remove this include now.
Sam McNally
2014/06/26 23:43:12
Done.
| |
| 15 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 class WebFrame; | 18 class WebFrame; |
| 19 class WebURLResponse; | 19 class WebURLResponse; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace gin { | 22 namespace gin { |
| 23 class ContextHolder; | 23 class ContextHolder; |
| 24 struct PendingModule; | 24 struct PendingModule; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 class ResourceFetcher; | 29 class ResourceFetcher; |
| 30 class WebUIRunner; | 30 class WebUIRunner; |
| 31 | 31 |
| 32 // WebUIMojoContextState manages the modules needed for mojo bindings. It does | 32 // WebUIMojoContextState manages the modules needed for mojo bindings. It does |
| 33 // this by way of gin. Non-builtin modules are downloaded by way of | 33 // this by way of gin. Non-builtin modules are downloaded by way of |
| 34 // ResourceFetchers. | 34 // ResourceFetchers. |
| 35 class WebUIMojoContextState : public gin::ModuleRegistryObserver { | 35 class WebUIMojoContextState : public gin::ModuleRegistryObserver { |
| 36 public: | 36 public: |
| 37 WebUIMojoContextState(blink::WebFrame* frame, | 37 WebUIMojoContextState(blink::WebFrame* frame, |
| 38 v8::Handle<v8::Context> context); | 38 v8::Handle<v8::Context> context); |
| 39 virtual ~WebUIMojoContextState(); | 39 virtual ~WebUIMojoContextState(); |
| 40 | 40 |
| 41 // Called once the mojo::Handle is available. | 41 void Run(); |
| 42 void SetHandle(mojo::ScopedMessagePipeHandle handle); | |
| 43 | 42 |
| 44 // Returns true if at least one module was added. | 43 // Returns true if at least one module was added. |
| 45 bool module_added() const { return module_added_; } | 44 bool module_added() const { return module_added_; } |
| 46 | 45 |
| 47 private: | 46 private: |
| 48 class Loader; | 47 class Loader; |
| 49 | 48 |
| 50 // Invokes FetchModule() for any modules that have not already been | 49 // Invokes FetchModule() for any modules that have not already been |
| 51 // downloaded. | 50 // downloaded. |
| 52 void FetchModules(const std::vector<std::string>& ids); | 51 void FetchModules(const std::vector<std::string>& ids); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 78 | 77 |
| 79 // Set of modules we've fetched script from. | 78 // Set of modules we've fetched script from. |
| 80 std::set<std::string> fetched_modules_; | 79 std::set<std::string> fetched_modules_; |
| 81 | 80 |
| 82 DISALLOW_COPY_AND_ASSIGN(WebUIMojoContextState); | 81 DISALLOW_COPY_AND_ASSIGN(WebUIMojoContextState); |
| 83 }; | 82 }; |
| 84 | 83 |
| 85 } // namespace content | 84 } // namespace content |
| 86 | 85 |
| 87 #endif // CONTENT_RENDERER_WEB_UI_MOJO_CONTEXT_STATE_H_ | 86 #endif // CONTENT_RENDERER_WEB_UI_MOJO_CONTEXT_STATE_H_ |
| OLD | NEW |