| 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/web_view/frame.h" | 5 #include "components/web_view/frame.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 uint32_t last_dispatch_load_event_frame_id() const { | 123 uint32_t last_dispatch_load_event_frame_id() const { |
| 124 return last_dispatch_load_event_frame_id_; | 124 return last_dispatch_load_event_frame_id_; |
| 125 } | 125 } |
| 126 | 126 |
| 127 // mojom::FrameClient: | 127 // mojom::FrameClient: |
| 128 void OnConnect(mojom::FramePtr frame, | 128 void OnConnect(mojom::FramePtr frame, |
| 129 uint32_t change_id, | 129 uint32_t change_id, |
| 130 uint32_t view_id, | 130 uint32_t view_id, |
| 131 mojom::ViewConnectType view_connect_type, | 131 mojom::ViewConnectType view_connect_type, |
| 132 mojo::Array<mojom::FrameDataPtr> frames, | 132 mojo::Array<mojom::FrameDataPtr> frames, |
| 133 int64_t navigation_start_time_ticks, |
| 133 const OnConnectCallback& callback) override { | 134 const OnConnectCallback& callback) override { |
| 134 connect_count_++; | 135 connect_count_++; |
| 135 connect_frames_ = frames.Pass(); | 136 connect_frames_ = frames.Pass(); |
| 136 if (frame) | 137 if (frame) |
| 137 server_frame_ = frame.Pass(); | 138 server_frame_ = frame.Pass(); |
| 138 callback.Run(); | 139 callback.Run(); |
| 139 if (!on_connect_callback_.is_null()) | 140 if (!on_connect_callback_.is_null()) |
| 140 on_connect_callback_.Run(); | 141 on_connect_callback_.Run(); |
| 141 } | 142 } |
| 142 void OnFrameAdded(uint32_t change_id, mojom::FrameDataPtr frame) override { | 143 void OnFrameAdded(uint32_t change_id, mojom::FrameDataPtr frame) override { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 scoped_ptr<FrameConnection> frame_connection = | 360 scoped_ptr<FrameConnection> frame_connection = |
| 360 CreateFrameConnection(application_impl()); | 361 CreateFrameConnection(application_impl()); |
| 361 mojom::FrameClient* frame_client = frame_connection->frame_client(); | 362 mojom::FrameClient* frame_client = frame_connection->frame_client(); |
| 362 mojo::ViewTreeClientPtr view_tree_client = | 363 mojo::ViewTreeClientPtr view_tree_client = |
| 363 frame_connection->GetViewTreeClient(); | 364 frame_connection->GetViewTreeClient(); |
| 364 mus::View* frame_root_view = window_manager()->CreateView(); | 365 mus::View* frame_root_view = window_manager()->CreateView(); |
| 365 window_manager()->GetRoot()->AddChild(frame_root_view); | 366 window_manager()->GetRoot()->AddChild(frame_root_view); |
| 366 frame_tree_.reset( | 367 frame_tree_.reset( |
| 367 new FrameTree(0u, frame_root_view, view_tree_client.Pass(), | 368 new FrameTree(0u, frame_root_view, view_tree_client.Pass(), |
| 368 frame_tree_delegate_.get(), frame_client, | 369 frame_tree_delegate_.get(), frame_client, |
| 369 frame_connection.Pass(), Frame::ClientPropertyMap())); | 370 frame_connection.Pass(), Frame::ClientPropertyMap(), |
| 371 base::TimeTicks::Now())); |
| 370 root_view_and_frame_ = WaitForViewAndFrame(); | 372 root_view_and_frame_ = WaitForViewAndFrame(); |
| 371 } | 373 } |
| 372 | 374 |
| 373 // Overridden from testing::Test: | 375 // Overridden from testing::Test: |
| 374 void TearDown() override { | 376 void TearDown() override { |
| 375 root_view_and_frame_.reset(); | 377 root_view_and_frame_.reset(); |
| 376 frame_tree_.reset(); | 378 frame_tree_.reset(); |
| 377 frame_tree_delegate_.reset(); | 379 frame_tree_delegate_.reset(); |
| 378 ApplicationTestBase::TearDown(); | 380 ApplicationTestBase::TearDown(); |
| 379 } | 381 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 child_view_and_frame->server_frame()->DispatchLoadEventToParent(); | 524 child_view_and_frame->server_frame()->DispatchLoadEventToParent(); |
| 523 | 525 |
| 524 run_loop.Run(); | 526 run_loop.Run(); |
| 525 | 527 |
| 526 uint32_t frame_id = root_view_and_frame() | 528 uint32_t frame_id = root_view_and_frame() |
| 527 ->test_frame_client() | 529 ->test_frame_client() |
| 528 ->last_dispatch_load_event_frame_id(); | 530 ->last_dispatch_load_event_frame_id(); |
| 529 EXPECT_EQ(child_frame_id, frame_id); | 531 EXPECT_EQ(child_frame_id, frame_id); |
| 530 } | 532 } |
| 531 } // namespace web_view | 533 } // namespace web_view |
| OLD | NEW |