Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "components/html_viewer/html_frame.h" | 5 #include "components/html_viewer/html_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 #include "components/html_viewer/stats_collection_controller.h" | 26 #include "components/html_viewer/stats_collection_controller.h" |
| 27 #include "components/html_viewer/touch_handler.h" | 27 #include "components/html_viewer/touch_handler.h" |
| 28 #include "components/html_viewer/web_layer_impl.h" | 28 #include "components/html_viewer/web_layer_impl.h" |
| 29 #include "components/html_viewer/web_layer_tree_view_impl.h" | 29 #include "components/html_viewer/web_layer_tree_view_impl.h" |
| 30 #include "components/html_viewer/web_storage_namespace_impl.h" | 30 #include "components/html_viewer/web_storage_namespace_impl.h" |
| 31 #include "components/html_viewer/web_url_loader_impl.h" | 31 #include "components/html_viewer/web_url_loader_impl.h" |
| 32 #include "components/view_manager/ids.h" | 32 #include "components/view_manager/ids.h" |
| 33 #include "components/view_manager/public/cpp/scoped_view_ptr.h" | 33 #include "components/view_manager/public/cpp/scoped_view_ptr.h" |
| 34 #include "components/view_manager/public/cpp/view.h" | 34 #include "components/view_manager/public/cpp/view.h" |
| 35 #include "components/view_manager/public/cpp/view_manager.h" | 35 #include "components/view_manager/public/cpp/view_manager.h" |
| 36 #include "components/view_manager/public/interfaces/surfaces.mojom.h" | 36 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" |
| 37 #include "mojo/application/public/cpp/application_impl.h" | 37 #include "mojo/application/public/cpp/application_impl.h" |
| 38 #include "mojo/application/public/cpp/connect.h" | 38 #include "mojo/application/public/cpp/connect.h" |
| 39 #include "mojo/application/public/interfaces/shell.mojom.h" | 39 #include "mojo/application/public/interfaces/shell.mojom.h" |
| 40 #include "mojo/converters/geometry/geometry_type_converters.h" | 40 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 41 #include "skia/ext/refptr.h" | 41 #include "skia/ext/refptr.h" |
| 42 #include "third_party/WebKit/public/platform/Platform.h" | 42 #include "third_party/WebKit/public/platform/Platform.h" |
| 43 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" | 43 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" |
| 44 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 44 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 45 #include "third_party/WebKit/public/platform/WebSize.h" | 45 #include "third_party/WebKit/public/platform/WebSize.h" |
| 46 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 46 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 555 // since it may have changed since the original postMessage call was made. | 555 // since it may have changed since the original postMessage call was made. |
| 556 blink::WebSecurityOrigin target_origin; | 556 blink::WebSecurityOrigin target_origin; |
| 557 if (!serialized_event->target_origin.is_null()) { | 557 if (!serialized_event->target_origin.is_null()) { |
| 558 target_origin = blink::WebSecurityOrigin::createFromString( | 558 target_origin = blink::WebSecurityOrigin::createFromString( |
| 559 serialized_event->target_origin.To<blink::WebString>()); | 559 serialized_event->target_origin.To<blink::WebString>()); |
| 560 } | 560 } |
| 561 target_web_frame->dispatchMessageEventWithOriginCheck(target_origin, | 561 target_web_frame->dispatchMessageEventWithOriginCheck(target_origin, |
| 562 msg_event); | 562 msg_event); |
| 563 } | 563 } |
| 564 | 564 |
| 565 void HTMLFrame::OnWillNavigate(uint32_t target_frame_id, | 565 void HTMLFrame::OnWillNavigate(uint32_t target_frame_id, |
|
rjkroege
2015/08/21 22:58:00
in the future, it would be nicer if you could sepa
| |
| 566 const OnWillNavigateCallback& callback) { | 566 const OnWillNavigateCallback& callback) { |
| 567 // Assume this process won't service the connection and swap to remote. | 567 // Assume this process won't service the connection and swap to remote. |
| 568 // It's entirely possible this process will service the connection and we | 568 // It's entirely possible this process will service the connection and we |
| 569 // don't need to swap, but the naive approach is much simpler. | 569 // don't need to swap, but the naive approach is much simpler. |
| 570 HTMLFrame* target = frame_tree_manager_->root_->FindFrame(target_frame_id); | 570 HTMLFrame* target = frame_tree_manager_->root_->FindFrame(target_frame_id); |
| 571 if (target && target->IsLocal() && | 571 if (target && target->IsLocal() && |
| 572 target != frame_tree_manager_->local_root_) { | 572 target != frame_tree_manager_->local_root_) { |
| 573 target->SwapToRemote(); | 573 target->SwapToRemote(); |
| 574 } | 574 } |
| 575 callback.Run(); | 575 callback.Run(); |
| 576 } | 576 } |
| 577 | 577 |
| 578 blink::WebStorageNamespace* HTMLFrame::createSessionStorageNamespace() { | 578 blink::WebStorageNamespace* HTMLFrame::createSessionStorageNamespace() { |
| 579 return new WebStorageNamespaceImpl(); | 579 return new WebStorageNamespaceImpl(); |
| 580 } | 580 } |
| 581 | 581 |
| 582 void HTMLFrame::didCancelCompositionOnSelectionChange() { | 582 void HTMLFrame::didCancelCompositionOnSelectionChange() { |
| 583 // TODO(penghuang): Update text input state. | 583 // TODO(penghuang): Update text input state. |
| 584 } | 584 } |
| 585 | 585 |
| 586 void HTMLFrame::didChangeContents() { | 586 void HTMLFrame::didChangeContents() { |
| 587 // TODO(penghuang): Update text input state. | 587 // TODO(penghuang): Update text input state. |
| 588 } | 588 } |
| 589 | 589 |
| 590 void HTMLFrame::initializeLayerTreeView() { | 590 void HTMLFrame::initializeLayerTreeView() { |
| 591 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 591 DCHECK(view()); |
| 592 request->url = mojo::String::From("mojo:view_manager"); | 592 |
| 593 mojo::SurfacePtr surface; | 593 mojo::CompositorFrameReceiverPtr receiver; |
| 594 GetLocalRootApp()->ConnectToService(request.Pass(), &surface); | 594 view()->RequestCompositorFrameReceiver(mojo::GetProxy(&receiver)); |
| 595 | 595 |
| 596 mojo::URLRequestPtr request2(mojo::URLRequest::New()); | 596 mojo::URLRequestPtr request2(mojo::URLRequest::New()); |
| 597 request2->url = mojo::String::From("mojo:view_manager"); | 597 request2->url = mojo::String::From("mojo:view_manager"); |
| 598 mojo::GpuPtr gpu_service; | 598 mojo::GpuPtr gpu_service; |
| 599 GetLocalRootApp()->ConnectToService(request2.Pass(), &gpu_service); | 599 GetLocalRootApp()->ConnectToService(request2.Pass(), &gpu_service); |
| 600 web_layer_tree_view_impl_.reset(new WebLayerTreeViewImpl( | 600 web_layer_tree_view_impl_.reset(new WebLayerTreeViewImpl( |
| 601 global_state()->compositor_thread(), | 601 global_state()->compositor_thread(), |
| 602 global_state()->gpu_memory_buffer_manager(), | 602 global_state()->gpu_memory_buffer_manager(), |
| 603 global_state()->raster_thread_helper()->task_graph_runner(), | 603 global_state()->raster_thread_helper()->task_graph_runner(), |
| 604 surface.Pass(), gpu_service.Pass())); | 604 receiver.Pass(), gpu_service.Pass())); |
| 605 } | 605 } |
| 606 | 606 |
| 607 blink::WebLayerTreeView* HTMLFrame::layerTreeView() { | 607 blink::WebLayerTreeView* HTMLFrame::layerTreeView() { |
| 608 return web_layer_tree_view_impl_.get(); | 608 return web_layer_tree_view_impl_.get(); |
| 609 } | 609 } |
| 610 | 610 |
| 611 void HTMLFrame::resetInputMethod() { | 611 void HTMLFrame::resetInputMethod() { |
| 612 // When this method gets called, WebWidgetClient implementation should | 612 // When this method gets called, WebWidgetClient implementation should |
| 613 // reset the input method by cancelling any ongoing composition. | 613 // reset the input method by cancelling any ongoing composition. |
| 614 // TODO(penghuang): Reset IME. | 614 // TODO(penghuang): Reset IME. |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 883 | 883 |
| 884 void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) { | 884 void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) { |
| 885 NOTIMPLEMENTED(); | 885 NOTIMPLEMENTED(); |
| 886 } | 886 } |
| 887 | 887 |
| 888 void HTMLFrame::forwardInputEvent(const blink::WebInputEvent* event) { | 888 void HTMLFrame::forwardInputEvent(const blink::WebInputEvent* event) { |
| 889 NOTIMPLEMENTED(); | 889 NOTIMPLEMENTED(); |
| 890 } | 890 } |
| 891 | 891 |
| 892 } // namespace mojo | 892 } // namespace mojo |
| OLD | NEW |