1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/html_viewer/html_frame.h"
10 #include "base/single_thread_task_runner.h"
11 #include "base/stl_util.h"
12 #include "base/strings/string_util.h"
13 #include "base/thread_task_runner_handle.h"
14 #include "components/html_viewer/ax_provider_impl.h"
15 #include "components/html_viewer/blink_basic_type_converters.h"
16 #include "components/html_viewer/blink_input_events_type_converters.h"
17 #include "components/html_viewer/blink_url_request_type_converters.h"
18 #include "components/html_viewer/geolocation_client_impl.h"
19 #include "components/html_viewer/global_state.h"
20 #include "components/html_viewer/html_frame_delegate.h"
21 #include "components/html_viewer/html_frame_tree_manager.h"
22 #include "components/html_viewer/media_factory.h"
23 #include "components/html_viewer/touch_handler.h"
24 #include "components/html_viewer/web_layer_impl.h"
25 #include "components/html_viewer/web_layer_tree_view_impl.h"
26 #include "components/html_viewer/web_storage_namespace_impl.h"
27 #include "components/html_viewer/web_url_loader_impl.h"
28 #include "components/view_manager/ids.h"
29 #include "components/view_manager/public/cpp/view.h"
30 #include "components/view_manager/public/cpp/view_manager.h"
31 #include "components/view_manager/public/interfaces/surfaces.mojom.h"
32 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h"
33 #include "mojo/application/public/cpp/application_impl.h"
34 #include "mojo/application/public/cpp/connect.h"
35 #include "mojo/application/public/interfaces/shell.mojom.h"
36 #include "mojo/converters/geometry/geometry_type_converters.h"
37 #include "skia/ext/refptr.h"
38 #include "third_party/WebKit/public/platform/Platform.h"
39 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h"
40 #include "third_party/WebKit/public/platform/WebSize.h"
41 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
42 #include "third_party/WebKit/public/web/WebDocument.h"
43 #include "third_party/WebKit/public/web/WebElement.h"
44 #include "third_party/WebKit/public/web/WebFrameWidget.h"
45 #include "third_party/WebKit/public/web/WebInputEvent.h"
46 #include "third_party/WebKit/public/web/WebLocalFrame.h"
47 #include "third_party/WebKit/public/web/WebNavigationPolicy.h"
48 #include "third_party/WebKit/public/web/WebRemoteFrame.h"
49 #include "third_party/WebKit/public/web/WebRemoteFrameClient.h"
50 #include "third_party/WebKit/public/web/WebScriptSource.h"
51 #include "third_party/WebKit/public/web/WebSettings.h"
52 #include "third_party/WebKit/public/web/WebView.h"
53 #include "third_party/mojo/src/mojo/public/cpp/system/data_pipe.h"
54 #include "third_party/skia/include/core/SkCanvas.h"
55 #include "third_party/skia/include/core/SkColor.h"
56 #include "third_party/skia/include/core/SkDevice.h"
57 #include "ui/gfx/geometry/dip_util.h"
58 #include "ui/gfx/geometry/size.h"
60 using mojo::AxProvider
;
62 using mojo::ServiceProviderPtr
;
63 using mojo::URLResponsePtr
;
65 using mojo::WeakBindToRequest
;
67 namespace html_viewer
{
70 mandoline::NavigationTarget
WebNavigationPolicyToNavigationTarget(
71 blink::WebNavigationPolicy policy
) {
73 case blink::WebNavigationPolicyCurrentTab
:
74 return mandoline::NAVIGATION_TARGET_SOURCE_NODE
;
75 case blink::WebNavigationPolicyNewBackgroundTab
:
76 case blink::WebNavigationPolicyNewForegroundTab
:
77 case blink::WebNavigationPolicyNewWindow
:
78 case blink::WebNavigationPolicyNewPopup
:
79 return mandoline::NAVIGATION_TARGET_NEW_NODE
;
81 return mandoline::NAVIGATION_TARGET_DEFAULT
;
85 void ConfigureSettings(blink::WebSettings
* settings
) {
86 settings
->setCookieEnabled(true);
87 settings
->setDefaultFixedFontSize(13);
88 settings
->setDefaultFontSize(16);
89 settings
->setLoadsImagesAutomatically(true);
90 settings
->setJavaScriptEnabled(true);
93 HTMLFrame
* GetPreviousSibling(HTMLFrame
* frame
) {
94 DCHECK(frame
->parent());
95 auto iter
= std::find(frame
->parent()->children().begin(),
96 frame
->parent()->children().end(), frame
);
97 return (iter
== frame
->parent()->children().begin()) ? nullptr : *(--iter
);
100 bool CanNavigateLocally(blink::WebFrame
* frame
,
101 const blink::WebURLRequest
& request
) {
102 // If we have extraData() it means we already have the url response
103 // (presumably because we are being called via Navigate()). In that case we
104 // can go ahead and navigate locally.
105 if (request
.extraData())
108 // Otherwise we don't know if we're the right app to handle this request. Ask
109 // host to do the navigation for us.
115 HTMLFrame::HTMLFrame(const HTMLFrame::CreateParams
& params
)
116 : frame_tree_manager_(params
.manager
),
117 parent_(params
.parent
),
121 web_widget_(nullptr),
122 scope_(blink::WebTreeScopeType::Document
),
124 weak_factory_(this) {
126 parent_
->children_
.push_back(this);
129 void HTMLFrame::Init(mojo::View
* local_view
,
130 const blink::WebString
& remote_frame_name
,
131 const blink::WebString
& remote_origin
) {
132 if (local_view
&& local_view
->id() == id_
)
135 // TODO(sky): need to plumb through scope and other args correctly for frame
139 // This is the root of the tree (aka the main frame).
140 // Expected order for creating webframes is:
141 // . Create local webframe (first webframe must always be local).
142 // . Set as main frame on WebView.
143 // . Swap to remote (if not local).
144 blink::WebLocalFrame
* local_web_frame
=
145 blink::WebLocalFrame::create(blink::WebTreeScopeType::Document
, this);
146 // We need to set the main frame before creating children so that state is
147 // properly set up in blink.
148 // TODO(sky): I don't like these casts.
149 web_view()->setMainFrame(local_web_frame
);
150 const gfx::Size
size_in_pixels(local_view
->bounds().width
,
151 local_view
->bounds().height
);
152 const gfx::Size size_in_dips
= gfx::ConvertSizeToDIP(
153 local_view
->viewport_metrics().device_pixel_ratio
, size_in_pixels
);
154 web_widget_
->resize(size_in_dips
);
155 web_frame_
= local_web_frame
;
156 web_view()->setDeviceScaleFactor(global_state()->device_pixel_ratio());
157 if (id_
!= local_view
->id()) {
158 blink::WebRemoteFrame
* remote_web_frame
= blink::WebRemoteFrame::create(
159 blink::WebTreeScopeType::Document
, this);
160 local_web_frame
->swap(remote_web_frame
);
161 web_frame_
= remote_web_frame
;
163 } else if (local_view
&& id_
== local_view
->id()) {
164 // Frame represents the local frame.
165 HTMLFrame
* previous_sibling
= GetPreviousSibling(this);
166 blink::WebFrame
* previous_web_frame
=
167 previous_sibling
? previous_sibling
->web_frame() : nullptr;
168 DCHECK(!parent_
->IsLocal());
169 web_frame_
= parent_
->web_frame()->toWebRemoteFrame()->createLocalChild(
170 blink::WebTreeScopeType::Document
, "", blink::WebSandboxFlags::None
,
171 this, previous_web_frame
);
173 } else if (!parent_
->IsLocal()) {
174 web_frame_
= parent_
->web_frame()->toWebRemoteFrame()->createRemoteChild(
175 blink::WebTreeScopeType::Document
, remote_frame_name
,
176 blink::WebSandboxFlags::None
, this);
178 // This is hit if we're asked to create a new local frame with a local
179 // parent. This should never happen (if we create a local child we don't
185 blink::WebRemoteFrame
* remote_web_frame
= web_frame_
->toWebRemoteFrame();
186 if (remote_web_frame
) {
187 remote_web_frame
->setReplicatedName(remote_frame_name
);
188 remote_web_frame
->setReplicatedOrigin(
189 blink::WebSecurityOrigin::createFromString(remote_origin
));
194 void HTMLFrame::Close() {
196 // Closing the widget implicitly detaches the frame.
197 web_widget_
->close();
199 web_frame_
->detach();
203 const HTMLFrame
* HTMLFrame::FindFrame(uint32_t id
) const {
207 for (const HTMLFrame
* child
: children_
) {
208 const HTMLFrame
* match
= child
->FindFrame(id
);
215 blink::WebView
* HTMLFrame::web_view() {
216 return web_widget_
&& web_widget_
->isWebView()
217 ? static_cast<blink::WebView
*>(web_widget_
)
221 bool HTMLFrame::HasLocalDescendant() const {
225 for (HTMLFrame
* child
: children_
) {
226 if (child
->HasLocalDescendant())
232 HTMLFrame::~HTMLFrame() {
233 DCHECK(children_
.empty());
237 std::find(parent_
->children_
.begin(), parent_
->children_
.end(), this);
238 parent_
->children_
.erase(iter
);
242 frame_tree_manager_
->OnFrameDestroyed(this);
245 view_
->RemoveObserver(this);
246 if (view_
->view_manager()->GetRoot() == view_
)
247 delete view_
->view_manager();
253 void HTMLFrame::Bind(mandoline::FrameTreeServerPtr frame_tree_server
,
254 mojo::InterfaceRequest
<mandoline::FrameTreeClient
>
255 frame_tree_client_request
) {
257 // TODO(sky): error handling.
258 server_
= frame_tree_server
.Pass();
259 frame_tree_client_binding_
.reset(
260 new mojo::Binding
<mandoline::FrameTreeClient
>(
261 this, frame_tree_client_request
.Pass()));
264 void HTMLFrame::SetRemoteFrameName(const mojo::String
& name
) {
268 blink::WebRemoteFrame
* remote_frame
= web_frame_
->toWebRemoteFrame();
270 remote_frame
->setReplicatedName(name
.To
<blink::WebString
>());
273 bool HTMLFrame::IsLocal() const {
274 return web_frame_
->isWebLocalFrame();
277 HTMLFrame
* HTMLFrame::GetLocalRoot() {
278 HTMLFrame
* frame
= this;
279 while (frame
&& !frame
->delegate_
)
280 frame
= frame
->parent_
;
284 mojo::ApplicationImpl
* HTMLFrame::GetLocalRootApp() {
285 return GetLocalRoot()->delegate_
->GetApp();
288 void HTMLFrame::SetView(mojo::View
* view
) {
289 // TODO(sky): figure out way to cleanup view.
291 view_
->RemoveObserver(this);
293 view_
->AddObserver(this);
296 void HTMLFrame::CreateWebWidget() {
297 DCHECK(!web_widget_
);
299 // TODO(sky): this isn't quite right. I should only have a WebFrameWidget
300 // for local roots. And the cast to local fram definitely isn't right.
302 blink::WebFrameWidget::create(this, web_frame_
->toWebLocalFrame());
303 } else if (view_
&& view_
->id() == id_
) {
304 web_widget_
= blink::WebView::create(this);
306 web_widget_
= blink::WebView::create(nullptr);
309 // Creating the widget calls initializeLayerTreeView() to create the
310 // |web_layer_tree_view_impl_|. As we haven't yet assigned the |web_widget_|
311 // we have to set it here.
312 if (web_layer_tree_view_impl_
) {
313 web_layer_tree_view_impl_
->set_widget(web_widget_
);
314 web_layer_tree_view_impl_
->set_view(view_
);
315 UpdateWebViewSizeFromViewSize();
319 ConfigureSettings(web_view()->settings());
322 void HTMLFrame::UpdateFocus() {
323 if (!web_widget_
|| !view_
)
325 const bool is_focused
= view_
&& view_
->HasFocus();
326 web_widget_
->setFocus(is_focused
);
327 if (web_widget_
->isWebView())
328 static_cast<blink::WebView
*>(web_widget_
)->setIsActive(is_focused
);
331 void HTMLFrame::UpdateWebViewSizeFromViewSize() {
332 if (!web_widget_
|| !view_
)
335 const gfx::Size
size_in_pixels(view_
->bounds().width
, view_
->bounds().height
);
336 const gfx::Size size_in_dips
= gfx::ConvertSizeToDIP(
337 view_
->viewport_metrics().device_pixel_ratio
, size_in_pixels
);
339 blink::WebSize(size_in_dips
.width(), size_in_dips
.height()));
340 web_layer_tree_view_impl_
->setViewportSize(size_in_pixels
);
343 void HTMLFrame::SwapToRemote(const blink::WebURLRequest
& request
) {
345 mojo::URLRequestPtr url_request
= mojo::URLRequest::From(request
);
346 view_
->EmbedAllowingReembed(url_request
.Pass());
348 // TODO(sky): I tried swapping the frame types here, but that resulted in
349 // the view never getting sized. Figure out why.
350 base::MessageLoop::current()->PostTask(
352 base::Bind(&HTMLFrame::FinishSwapToRemote
, weak_factory_
.GetWeakPtr()));
355 void HTMLFrame::FinishSwapToRemote() {
356 if (web_frame_
->isWebRemoteFrame())
357 return; // We already did the swap.
359 blink::WebRemoteFrame
* remote_frame
=
360 blink::WebRemoteFrame::create(scope_
, this);
361 remote_frame
->initializeFromFrame(web_frame_
->toWebLocalFrame());
362 // swap() ends up calling us back and we then close the frame.
363 web_frame_
->swap(remote_frame
);
364 web_layer_
.reset(new WebLayerImpl(this));
365 remote_frame
->setRemoteWebLayer(web_layer_
.get());
366 web_frame_
= remote_frame
;
369 void HTMLFrame::SwapToLocal(mojo::View
* view
, const blink::WebString
& name
) {
371 // It doesn't make sense for the root to swap to local.
374 // TODO(sky): plumb through proper scope.
375 blink::WebLocalFrame
* local_web_frame
=
376 blink::WebLocalFrame::create(blink::WebTreeScopeType::Document
, this);
377 local_web_frame
->initializeToReplaceRemoteFrame(
378 web_frame_
->toWebRemoteFrame(), name
, blink::WebSandboxFlags::None
);
379 // The swap() ends up calling to frameDetached() and deleting the old.
380 web_frame_
->swap(local_web_frame
);
381 web_frame_
= local_web_frame
;
384 HTMLFrame
* HTMLFrame::FindFrameWithWebFrame(blink::WebFrame
* web_frame
) {
385 if (web_frame_
== web_frame
)
387 for (HTMLFrame
* child_frame
: children_
) {
388 HTMLFrame
* result
= child_frame
->FindFrameWithWebFrame(web_frame
);
395 void HTMLFrame::FrameDetachedImpl(blink::WebFrame
* web_frame
) {
396 DCHECK_EQ(web_frame_
, web_frame
);
398 while (!children_
.empty()) {
399 HTMLFrame
* child
= children_
.front();
401 DCHECK(children_
.empty() || children_
.front() != child
);
404 if (web_frame
->parent())
405 web_frame
->parent()->removeChild(web_frame
);
410 void HTMLFrame::OnViewBoundsChanged(View
* view
,
411 const Rect
& old_bounds
,
412 const Rect
& new_bounds
) {
413 DCHECK_EQ(view
, view_
);
414 UpdateWebViewSizeFromViewSize();
417 void HTMLFrame::OnViewDestroyed(View
* view
) {
418 DCHECK_EQ(view
, view_
);
419 view_
->RemoveObserver(this);
424 void HTMLFrame::OnViewInputEvent(View
* view
, const mojo::EventPtr
& event
) {
425 if (event
->pointer_data
) {
426 // Blink expects coordintes to be in DIPs.
427 event
->pointer_data
->x
/= global_state()->device_pixel_ratio();
428 event
->pointer_data
->y
/= global_state()->device_pixel_ratio();
429 event
->pointer_data
->screen_x
/= global_state()->device_pixel_ratio();
430 event
->pointer_data
->screen_y
/= global_state()->device_pixel_ratio();
433 if (!touch_handler_
&& web_widget_
)
434 touch_handler_
.reset(new TouchHandler(web_widget_
));
436 if ((event
->action
== mojo::EVENT_TYPE_POINTER_DOWN
||
437 event
->action
== mojo::EVENT_TYPE_POINTER_UP
||
438 event
->action
== mojo::EVENT_TYPE_POINTER_CANCEL
||
439 event
->action
== mojo::EVENT_TYPE_POINTER_MOVE
) &&
440 event
->pointer_data
->kind
== mojo::POINTER_KIND_TOUCH
) {
441 touch_handler_
->OnTouchEvent(*event
);
448 scoped_ptr
<blink::WebInputEvent
> web_event
=
449 event
.To
<scoped_ptr
<blink::WebInputEvent
>>();
451 web_widget_
->handleInputEvent(*web_event
);
454 void HTMLFrame::OnViewFocusChanged(mojo::View
* gained_focus
,
455 mojo::View
* lost_focus
) {
459 void HTMLFrame::OnConnect(mandoline::FrameTreeServerPtr server
,
460 mojo::Array
<mandoline::FrameDataPtr
> frame_data
) {
461 // OnConnect() is only sent once, and has been received (by
462 // DocumentResourceWaiter) by the time we get here.
466 void HTMLFrame::OnFrameAdded(mandoline::FrameDataPtr frame_data
) {
467 frame_tree_manager_
->ProcessOnFrameAdded(this, frame_data
.Pass());
470 void HTMLFrame::OnFrameRemoved(uint32_t frame_id
) {
471 frame_tree_manager_
->ProcessOnFrameRemoved(this, frame_id
);
474 void HTMLFrame::OnFrameNameChanged(uint32_t frame_id
,
475 const mojo::String
& name
) {
476 frame_tree_manager_
->ProcessOnFrameNameChanged(this, frame_id
, name
);
479 void HTMLFrame::initializeLayerTreeView() {
480 mojo::URLRequestPtr
request(mojo::URLRequest::New());
481 request
->url
= mojo::String::From("mojo:surfaces_service");
482 mojo::SurfacePtr surface
;
483 GetLocalRootApp()->ConnectToService(request
.Pass(), &surface
);
485 // TODO(jamesr): Should be mojo:gpu_service
486 mojo::URLRequestPtr
request2(mojo::URLRequest::New());
487 request2
->url
= mojo::String::From("mojo:view_manager");
488 mojo::GpuPtr gpu_service
;
489 GetLocalRootApp()->ConnectToService(request2
.Pass(), &gpu_service
);
490 web_layer_tree_view_impl_
.reset(new WebLayerTreeViewImpl(
491 global_state()->compositor_thread(),
492 global_state()->gpu_memory_buffer_manager(),
493 global_state()->raster_thread_helper()->task_graph_runner(),
494 surface
.Pass(), gpu_service
.Pass()));
497 blink::WebLayerTreeView
* HTMLFrame::layerTreeView() {
498 return web_layer_tree_view_impl_
.get();
501 blink::WebStorageNamespace
* HTMLFrame::createSessionStorageNamespace() {
502 return new WebStorageNamespaceImpl();
505 blink::WebMediaPlayer
* HTMLFrame::createMediaPlayer(
506 blink::WebLocalFrame
* frame
,
507 const blink::WebURL
& url
,
508 blink::WebMediaPlayerClient
* client
,
509 blink::WebMediaPlayerEncryptedMediaClient
* encrypted_client
,
510 blink::WebContentDecryptionModule
* initial_cdm
) {
511 return global_state()->media_factory()->CreateMediaPlayer(
512 frame
, url
, client
, encrypted_client
, initial_cdm
,
513 GetLocalRootApp()->shell());
516 blink::WebFrame
* HTMLFrame::createChildFrame(
517 blink::WebLocalFrame
* parent
,
518 blink::WebTreeScopeType scope
,
519 const blink::WebString
& frame_name
,
520 blink::WebSandboxFlags sandbox_flags
) {
521 DCHECK(IsLocal()); // Can't create children of remote frames.
522 DCHECK_EQ(parent
, web_frame_
);
523 DCHECK(view_
); // If we're local we have to have a view.
524 // Create the view that will house the frame now. We embed once we know the
525 // url (see decidePolicyForNavigation()).
526 mojo::View
* child_view
= view_
->view_manager()->CreateView();
527 child_view
->SetVisible(true);
528 view_
->AddChild(child_view
);
530 // TODO(sky): there needs to be way to communicate properties to the
532 GetLocalRoot()->server_
->OnCreatedFrame(id_
, child_view
->id());
534 HTMLFrame::CreateParams
params(frame_tree_manager_
, this, child_view
->id());
535 HTMLFrame
* child_frame
= new HTMLFrame(params
);
536 child_frame
->scope_
= scope
;
538 child_frame
->SetView(child_view
);
540 blink::WebLocalFrame
* child_web_frame
=
541 blink::WebLocalFrame::create(scope
, child_frame
);
542 child_frame
->web_frame_
= child_web_frame
;
543 parent
->appendChild(child_web_frame
);
544 return child_web_frame
;
547 void HTMLFrame::frameDetached(blink::WebFrame
* web_frame
,
548 blink::WebFrameClient::DetachType type
) {
549 if (type
== blink::WebFrameClient::DetachType::Swap
) {
554 DCHECK(type
== blink::WebFrameClient::DetachType::Remove
);
555 FrameDetachedImpl(web_frame
);
558 blink::WebCookieJar
* HTMLFrame::cookieJar(blink::WebLocalFrame
* frame
) {
559 // TODO(darin): Blink does not fallback to the Platform provided WebCookieJar.
560 // Either it should, as it once did, or we should find another solution here.
561 return blink::Platform::current()->cookieJar();
564 blink::WebNavigationPolicy
HTMLFrame::decidePolicyForNavigation(
565 const NavigationPolicyInfo
& info
) {
566 if (parent_
&& parent_
->IsLocal() && GetLocalRoot() != this) {
567 // TODO(sky): this may be too early. I might want to wait to see if an embed
568 // actually happens, and swap then.
569 SwapToRemote(info
.urlRequest
);
570 return blink::WebNavigationPolicyIgnore
;
573 if (info
.frame
== web_frame() && this == frame_tree_manager_
->root_
&&
574 delegate_
&& delegate_
->ShouldNavigateLocallyInMainFrame()) {
575 return info
.defaultPolicy
;
578 if (CanNavigateLocally(info
.frame
, info
.urlRequest
))
579 return info
.defaultPolicy
;
581 mojo::URLRequestPtr url_request
= mojo::URLRequest::From(info
.urlRequest
);
582 GetLocalRoot()->server_
->RequestNavigate(
583 id(), WebNavigationPolicyToNavigationTarget(info
.defaultPolicy
),
586 return blink::WebNavigationPolicyIgnore
;
589 void HTMLFrame::didAddMessageToConsole(const blink::WebConsoleMessage
& message
,
590 const blink::WebString
& source_name
,
591 unsigned source_line
,
592 const blink::WebString
& stack_trace
) {
593 VLOG(1) << "[" << source_name
.utf8() << "(" << source_line
<< ")] "
594 << message
.text
.utf8();
597 void HTMLFrame::didFinishLoad(blink::WebLocalFrame
* frame
) {
598 if (GetLocalRoot() == this)
599 delegate_
->OnFrameDidFinishLoad();
602 void HTMLFrame::didNavigateWithinPage(blink::WebLocalFrame
* frame
,
603 const blink::WebHistoryItem
& history_item
,
604 blink::WebHistoryCommitType commit_type
) {
605 GetLocalRoot()->server_
->DidNavigateLocally(id_
,
606 history_item
.urlString().utf8());
609 blink::WebGeolocationClient
* HTMLFrame::geolocationClient() {
610 if (!geolocation_client_impl_
)
611 geolocation_client_impl_
.reset(new GeolocationClientImpl
);
612 return geolocation_client_impl_
.get();
615 blink::WebEncryptedMediaClient
* HTMLFrame::encryptedMediaClient() {
616 return global_state()->media_factory()->GetEncryptedMediaClient();
619 void HTMLFrame::didStartLoading(bool to_different_document
) {
620 GetLocalRoot()->server_
->LoadingStarted(id_
);
623 void HTMLFrame::didStopLoading() {
624 GetLocalRoot()->server_
->LoadingStopped(id_
);
627 void HTMLFrame::didChangeLoadProgress(double load_progress
) {
628 GetLocalRoot()->server_
->ProgressChanged(id_
, load_progress
);
631 void HTMLFrame::didChangeName(blink::WebLocalFrame
* frame
,
632 const blink::WebString
& name
) {
633 mojo::String mojo_name
;
635 mojo_name
= name
.utf8();
636 GetLocalRoot()->server_
->SetFrameName(id_
, mojo_name
);
639 void HTMLFrame::frameDetached(blink::WebRemoteFrameClient::DetachType type
) {
640 if (type
== blink::WebRemoteFrameClient::DetachType::Swap
) {
645 DCHECK(type
== blink::WebRemoteFrameClient::DetachType::Remove
);
646 FrameDetachedImpl(web_frame_
);
649 void HTMLFrame::postMessageEvent(blink::WebLocalFrame
* source_frame
,
650 blink::WebRemoteFrame
* target_frame
,
651 blink::WebSecurityOrigin target_origin
,
652 blink::WebDOMMessageEvent event
) {
656 void HTMLFrame::initializeChildFrame(const blink::WebRect
& frame_rect
,
657 float scale_factor
) {
658 // TODO(sky): frame_rect is in dips. Need to convert.
660 rect
.x
= frame_rect
.x
;
661 rect
.y
= frame_rect
.y
;
662 rect
.width
= frame_rect
.width
;
663 rect
.height
= frame_rect
.height
;
664 view_
->SetBounds(rect
);
667 void HTMLFrame::navigate(const blink::WebURLRequest
& request
,
668 bool should_replace_current_entry
) {
672 void HTMLFrame::reload(bool ignore_cache
, bool is_client_redirect
) {
676 void HTMLFrame::forwardInputEvent(const blink::WebInputEvent
* event
) {