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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2405093003: [WIP] Mojo native bindings interface.
Patch Set: cleanup 2 Created 4 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 #include "media/base/audio_renderer_mixer_input.h" 143 #include "media/base/audio_renderer_mixer_input.h"
144 #include "media/base/cdm_factory.h" 144 #include "media/base/cdm_factory.h"
145 #include "media/base/decoder_factory.h" 145 #include "media/base/decoder_factory.h"
146 #include "media/base/media.h" 146 #include "media/base/media.h"
147 #include "media/base/media_log.h" 147 #include "media/base/media_log.h"
148 #include "media/base/media_switches.h" 148 #include "media/base/media_switches.h"
149 #include "media/blink/url_index.h" 149 #include "media/blink/url_index.h"
150 #include "media/blink/webencryptedmediaclient_impl.h" 150 #include "media/blink/webencryptedmediaclient_impl.h"
151 #include "media/blink/webmediaplayer_impl.h" 151 #include "media/blink/webmediaplayer_impl.h"
152 #include "media/renderers/gpu_video_accelerator_factories.h" 152 #include "media/renderers/gpu_video_accelerator_factories.h"
153 #include "mojo/edk/js/core.h"
154 #include "mojo/edk/js/support.h"
155 #include "net/base/data_url.h" 153 #include "net/base/data_url.h"
156 #include "net/base/net_errors.h" 154 #include "net/base/net_errors.h"
157 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 155 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
158 #include "net/http/http_util.h" 156 #include "net/http/http_util.h"
159 #include "ppapi/features/features.h" 157 #include "ppapi/features/features.h"
160 #include "services/service_manager/public/cpp/interface_provider.h" 158 #include "services/service_manager/public/cpp/interface_provider.h"
161 #include "services/service_manager/public/cpp/interface_registry.h" 159 #include "services/service_manager/public/cpp/interface_registry.h"
162 #include "storage/common/data_element.h" 160 #include "storage/common/data_element.h"
163 #include "third_party/WebKit/public/platform/FilePathConversion.h" 161 #include "third_party/WebKit/public/platform/FilePathConversion.h"
164 #include "third_party/WebKit/public/platform/URLConversion.h" 162 #include "third_party/WebKit/public/platform/URLConversion.h"
(...skipping 14 matching lines...) Expand all
179 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 177 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
180 #include "third_party/WebKit/public/web/WebDocument.h" 178 #include "third_party/WebKit/public/web/WebDocument.h"
181 #include "third_party/WebKit/public/web/WebFindOptions.h" 179 #include "third_party/WebKit/public/web/WebFindOptions.h"
182 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" 180 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h"
183 #include "third_party/WebKit/public/web/WebFrameSerializer.h" 181 #include "third_party/WebKit/public/web/WebFrameSerializer.h"
184 #include "third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h" 182 #include "third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h"
185 #include "third_party/WebKit/public/web/WebFrameWidget.h" 183 #include "third_party/WebKit/public/web/WebFrameWidget.h"
186 #include "third_party/WebKit/public/web/WebKit.h" 184 #include "third_party/WebKit/public/web/WebKit.h"
187 #include "third_party/WebKit/public/web/WebLocalFrame.h" 185 #include "third_party/WebKit/public/web/WebLocalFrame.h"
188 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" 186 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
187 #include "third_party/WebKit/public/web/WebMojoBindings.h"
189 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" 188 #include "third_party/WebKit/public/web/WebNavigationPolicy.h"
190 #include "third_party/WebKit/public/web/WebPlugin.h" 189 #include "third_party/WebKit/public/web/WebPlugin.h"
191 #include "third_party/WebKit/public/web/WebPluginContainer.h" 190 #include "third_party/WebKit/public/web/WebPluginContainer.h"
192 #include "third_party/WebKit/public/web/WebPluginDocument.h" 191 #include "third_party/WebKit/public/web/WebPluginDocument.h"
193 #include "third_party/WebKit/public/web/WebPluginParams.h" 192 #include "third_party/WebKit/public/web/WebPluginParams.h"
194 #include "third_party/WebKit/public/web/WebRange.h" 193 #include "third_party/WebKit/public/web/WebRange.h"
195 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 194 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
196 #include "third_party/WebKit/public/web/WebScriptSource.h" 195 #include "third_party/WebKit/public/web/WebScriptSource.h"
197 #include "third_party/WebKit/public/web/WebSearchableFormData.h" 196 #include "third_party/WebKit/public/web/WebSearchableFormData.h"
198 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 197 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 #define STATIC_ASSERT_ENUM(a, b) \ 320 #define STATIC_ASSERT_ENUM(a, b) \
322 static_assert(static_cast<int>(a) == static_cast<int>(b), \ 321 static_assert(static_cast<int>(a) == static_cast<int>(b), \
323 "mismatching enums: " #a) 322 "mismatching enums: " #a)
324 323
325 namespace content { 324 namespace content {
326 325
327 namespace { 326 namespace {
328 327
329 const int kExtraCharsBeforeAndAfterSelection = 100; 328 const int kExtraCharsBeforeAndAfterSelection = 100;
330 329
330 const char kMojoModuleNameCore[] = "mojo/public/js/core";
331
331 typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap; 332 typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap;
332 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map = 333 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map =
333 LAZY_INSTANCE_INITIALIZER; 334 LAZY_INSTANCE_INITIALIZER;
334 335
335 typedef std::map<blink::WebFrame*, RenderFrameImpl*> FrameMap; 336 typedef std::map<blink::WebFrame*, RenderFrameImpl*> FrameMap;
336 base::LazyInstance<FrameMap> g_frame_map = LAZY_INSTANCE_INITIALIZER; 337 base::LazyInstance<FrameMap> g_frame_map = LAZY_INSTANCE_INITIALIZER;
337 338
338 int64_t ExtractPostId(const WebHistoryItem& item) { 339 int64_t ExtractPostId(const WebHistoryItem& item) {
339 if (item.isNull() || item.httpBody().isNull()) 340 if (item.isNull() || item.httpBody().isNull())
340 return -1; 341 return -1;
(...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 size_t offset, 2569 size_t offset,
2569 const gfx::Range& range) { 2570 const gfx::Range& range) {
2570 Send(new FrameHostMsg_SelectionChanged(routing_id_, selection_text, 2571 Send(new FrameHostMsg_SelectionChanged(routing_id_, selection_text,
2571 static_cast<uint32_t>(offset), range)); 2572 static_cast<uint32_t>(offset), range));
2572 } 2573 }
2573 2574
2574 void RenderFrameImpl::EnsureMojoBuiltinsAreAvailable( 2575 void RenderFrameImpl::EnsureMojoBuiltinsAreAvailable(
2575 v8::Isolate* isolate, 2576 v8::Isolate* isolate,
2576 v8::Local<v8::Context> context) { 2577 v8::Local<v8::Context> context) {
2577 gin::ModuleRegistry* registry = gin::ModuleRegistry::From(context); 2578 gin::ModuleRegistry* registry = gin::ModuleRegistry::From(context);
2578 if (registry->available_modules().count(mojo::edk::js::Core::kModuleName)) 2579 if (registry->available_modules().count(kMojoModuleNameCore))
2579 return; 2580 return;
2580 2581
2581 v8::HandleScope handle_scope(isolate); 2582 v8::HandleScope handle_scope(isolate);
2582 registry->AddBuiltinModule(isolate, mojo::edk::js::Core::kModuleName, 2583 registry->AddBuiltinModule(isolate, kMojoModuleNameCore,
2583 mojo::edk::js::Core::GetModule(isolate)); 2584 blink::WebMojoBindings::create(context));
2584 registry->AddBuiltinModule(isolate, mojo::edk::js::Support::kModuleName,
2585 mojo::edk::js::Support::GetModule(isolate));
2586 registry->AddBuiltinModule( 2585 registry->AddBuiltinModule(
2587 isolate, InterfaceProviderJsWrapper::kPerFrameModuleName, 2586 isolate, InterfaceProviderJsWrapper::kPerFrameModuleName,
2588 InterfaceProviderJsWrapper::Create( 2587 InterfaceProviderJsWrapper::Create(
2589 isolate, context, remote_interfaces_.get()) 2588 isolate, context, remote_interfaces_.get())
2590 .ToV8()); 2589 .ToV8());
2591 registry->AddBuiltinModule( 2590 registry->AddBuiltinModule(
2592 isolate, InterfaceProviderJsWrapper::kPerProcessModuleName, 2591 isolate, InterfaceProviderJsWrapper::kPerProcessModuleName,
2593 InterfaceProviderJsWrapper::Create( 2592 InterfaceProviderJsWrapper::Create(
2594 isolate, context, RenderThread::Get()->GetRemoteInterfaces()) 2593 isolate, context, RenderThread::Get()->GetRemoteInterfaces())
2595 .ToV8()); 2594 .ToV8());
(...skipping 3972 matching lines...) Expand 10 before | Expand all | Expand 10 after
6568 // event target. Potentially a Pepper plugin will receive the event. 6567 // event target. Potentially a Pepper plugin will receive the event.
6569 // In order to tell whether a plugin gets the last mouse event and which it 6568 // In order to tell whether a plugin gets the last mouse event and which it
6570 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6569 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6571 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6570 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6572 // |pepper_last_mouse_event_target_|. 6571 // |pepper_last_mouse_event_target_|.
6573 pepper_last_mouse_event_target_ = nullptr; 6572 pepper_last_mouse_event_target_ = nullptr;
6574 #endif 6573 #endif
6575 } 6574 }
6576 6575
6577 } // namespace content 6576 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698