diff options
author | fsamuel <fsamuel@chromium.org> | 2015-10-15 17:12:45 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-16 00:13:20 +0000 |
commit | 68afcf453d29c8f311b34a0aa210e042d4adc132 (patch) | |
tree | 5d7e25e02abe745aec485ecb4450f37d24b080c8 /components/web_view | |
parent | da33ab883a2046613836487d852d5fd36f1dc4c3 (diff) | |
download | chromium_src-68afcf453d29c8f311b34a0aa210e042d4adc132.zip chromium_src-68afcf453d29c8f311b34a0aa210e042d4adc132.tar.gz chromium_src-68afcf453d29c8f311b34a0aa210e042d4adc132.tar.bz2 |
View => Window in components/mus/public/cpp
This CL updates the client lib to refer to mus::Windows and
mus::WindowServer instead of View and View Manager.
I hope I caught everything. I'll clean things up in
subsequent CLs, and start renaming the interfaces and
implementation.
BUG=542848
Review URL: https://codereview.chromium.org/1402223003
Cr-Commit-Position: refs/heads/master@{#354411}
Diffstat (limited to 'components/web_view')
-rw-r--r-- | components/web_view/frame.cc | 25 | ||||
-rw-r--r-- | components/web_view/frame.h | 22 | ||||
-rw-r--r-- | components/web_view/frame_apptest.cc | 61 | ||||
-rw-r--r-- | components/web_view/frame_tree.cc | 4 | ||||
-rw-r--r-- | components/web_view/frame_tree.h | 4 | ||||
-rw-r--r-- | components/web_view/frame_tree_delegate.cc | 2 | ||||
-rw-r--r-- | components/web_view/frame_tree_delegate.h | 2 | ||||
-rw-r--r-- | components/web_view/public/cpp/web_view.cc | 8 | ||||
-rw-r--r-- | components/web_view/public/cpp/web_view.h | 4 | ||||
-rw-r--r-- | components/web_view/test_frame_tree_delegate.cc | 2 | ||||
-rw-r--r-- | components/web_view/test_frame_tree_delegate.h | 4 | ||||
-rw-r--r-- | components/web_view/test_runner/test_runner_application_delegate.cc | 20 | ||||
-rw-r--r-- | components/web_view/test_runner/test_runner_application_delegate.h | 14 | ||||
-rw-r--r-- | components/web_view/web_view_apptest.cc | 25 | ||||
-rw-r--r-- | components/web_view/web_view_impl.cc | 28 | ||||
-rw-r--r-- | components/web_view/web_view_impl.h | 28 |
16 files changed, 128 insertions, 125 deletions
diff --git a/components/web_view/frame.cc b/components/web_view/frame.cc index 96fd328..9cc9163 100644 --- a/components/web_view/frame.cc +++ b/components/web_view/frame.cc @@ -10,8 +10,8 @@ #include "base/bind.h" #include "base/callback.h" #include "base/stl_util.h" -#include "components/mus/public/cpp/view.h" -#include "components/mus/public/cpp/view_property.h" +#include "components/mus/public/cpp/window.h" +#include "components/mus/public/cpp/window_property.h" #include "components/web_view/frame_tree.h" #include "components/web_view/frame_tree_delegate.h" #include "components/web_view/frame_user_data.h" @@ -20,14 +20,14 @@ #include "mojo/common/url_type_converters.h" #include "url/gurl.h" -using mus::View; +using mus::Window; -DECLARE_VIEW_PROPERTY_TYPE(web_view::Frame*); +DECLARE_WINDOW_PROPERTY_TYPE(web_view::Frame*); namespace web_view { // Used to find the Frame associated with a View. -DEFINE_LOCAL_VIEW_PROPERTY_KEY(Frame*, kFrame, nullptr); +DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Frame*, kFrame, nullptr); namespace { @@ -52,7 +52,7 @@ struct Frame::FrameUserDataAndBinding { }; Frame::Frame(FrameTree* tree, - View* view, + Window* view, uint32_t frame_id, uint32_t app_id, ViewOwnership view_ownership, @@ -120,7 +120,7 @@ void Frame::Init(Frame* parent, } // static -Frame* Frame::FindFirstFrameAncestor(View* view) { +Frame* Frame::FindFirstFrameAncestor(Window* view) { while (view && !view->GetLocalProperty(kFrame)) view = view->parent(); return view ? view->GetLocalProperty(kFrame) : nullptr; @@ -301,7 +301,7 @@ void Frame::OnWillNavigateAck(mojom::FrameClient* frame_client, StartNavigate(pending_navigate_.Pass()); } -void Frame::SetView(mus::View* view) { +void Frame::SetView(mus::Window* view) { DCHECK(!view_); DCHECK_EQ(id_, view->id()); view_ = view; @@ -442,7 +442,7 @@ void Frame::OnTreeChanged(const TreeChangeParams& params) { } } -void Frame::OnViewDestroying(mus::View* view) { +void Frame::OnWindowDestroying(mus::Window* view) { if (parent_) parent_->Remove(this); @@ -459,15 +459,16 @@ void Frame::OnViewDestroying(mus::View* view) { delete this; } -void Frame::OnViewEmbeddedAppDisconnected(mus::View* view) { - // See FrameTreeDelegate::OnViewEmbeddedAppDisconnected() for details of when +void Frame::OnWindowEmbeddedAppDisconnected(mus::Window* view) { + // See FrameTreeDelegate::OnWindowEmbeddedAppDisconnected() for details of + // when // this happens. // // Currently we have no way to distinguish between the cases that lead to this // being called, so we assume we can continue on. Continuing on is important // for html as it's entirely possible for a page to create a frame, navigate // to a bogus url and expect the frame to still exist. - tree_->delegate_->OnViewEmbeddedInFrameDisconnected(this); + tree_->delegate_->OnWindowEmbeddedInFrameDisconnected(this); } void Frame::PostMessageEventToFrame(uint32_t target_frame_id, diff --git a/components/web_view/frame.h b/components/web_view/frame.h index 361c66a..38e1078 100644 --- a/components/web_view/frame.h +++ b/components/web_view/frame.h @@ -12,7 +12,7 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "components/mus/public/cpp/types.h" -#include "components/mus/public/cpp/view_observer.h" +#include "components/mus/public/cpp/window_observer.h" #include "components/web_view/public/interfaces/frame.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" @@ -52,13 +52,13 @@ enum class ViewOwnership { // the argument |reuse_existing_view| supplied to OnConnect(). Typically the id // is that of content handler id, but this is left up to the FrameTreeDelegate // to decide. -class Frame : public mus::ViewObserver, public mojom::Frame { +class Frame : public mus::WindowObserver, public mojom::Frame { public: using ClientPropertyMap = std::map<std::string, std::vector<uint8_t>>; using FindCallback = mojo::Callback<void(bool)>; Frame(FrameTree* tree, - mus::View* view, + mus::Window* view, uint32_t frame_id, uint32_t app_id, ViewOwnership view_ownership, @@ -76,15 +76,15 @@ class Frame : public mus::ViewObserver, public mojom::Frame { // Frame that is associated with |view|. For example, if |view| // has a Frame associated with it, then that is returned. Otherwise // this checks view->parent() and so on. - static Frame* FindFirstFrameAncestor(mus::View* view); + static Frame* FindFirstFrameAncestor(mus::Window* view); FrameTree* tree() { return tree_; } Frame* parent() { return parent_; } const Frame* parent() const { return parent_; } - mus::View* view() { return view_; } - const mus::View* view() const { return view_; } + mus::Window* view() { return view_; } + const mus::Window* view() const { return view_; } uint32_t id() const { return id_; } @@ -187,7 +187,7 @@ class Frame : public mus::ViewObserver, public mojom::Frame { uint32 app_id, base::TimeTicks navigation_start_time); - void SetView(mus::View* view); + void SetView(mus::Window* view); // Adds this to |frames| and recurses through the children calling the // same function. @@ -220,10 +220,10 @@ class Frame : public mus::ViewObserver, public mojom::Frame { void NotifyFrameLoadingStateChanged(const Frame* frame, bool loading); void NotifyDispatchFrameLoadEvent(const Frame* frame); - // mus::ViewObserver: + // mus::WindowObserver: void OnTreeChanged(const TreeChangeParams& params) override; - void OnViewDestroying(mus::View* view) override; - void OnViewEmbeddedAppDisconnected(mus::View* view) override; + void OnWindowDestroying(mus::Window* view) override; + void OnWindowEmbeddedAppDisconnected(mus::Window* view) override; // mojom::Frame: void PostMessageEventToFrame(uint32_t target_frame_id, @@ -251,7 +251,7 @@ class Frame : public mus::ViewObserver, public mojom::Frame { FrameTree* const tree_; // WARNING: this may be null. See class description for details. - mus::View* view_; + mus::Window* view_; // The connection id returned from ViewManager::Embed(). Frames created by // way of OnCreatedFrame() inherit the id from the parent. mus::ConnectionSpecificId embedded_connection_id_; diff --git a/components/web_view/frame_apptest.cc b/components/web_view/frame_apptest.cc index 629b081..a8f0bb8 100644 --- a/components/web_view/frame_apptest.cc +++ b/components/web_view/frame_apptest.cc @@ -11,10 +11,10 @@ #include "base/run_loop.h" #include "base/test/test_timeouts.h" #include "base/time/time.h" -#include "components/mus/public/cpp/view_observer.h" -#include "components/mus/public/cpp/view_tree_connection.h" -#include "components/mus/public/cpp/view_tree_delegate.h" -#include "components/mus/public/cpp/view_tree_host_factory.h" +#include "components/mus/public/cpp/window_observer.h" +#include "components/mus/public/cpp/window_tree_connection.h" +#include "components/mus/public/cpp/window_tree_delegate.h" +#include "components/mus/public/cpp/window_tree_host_factory.h" #include "components/web_view/frame.h" #include "components/web_view/frame_connection.h" #include "components/web_view/frame_tree.h" @@ -27,8 +27,8 @@ #include "mojo/application/public/cpp/application_test_base.h" #include "mojo/application/public/cpp/service_provider_impl.h" -using mus::View; -using mus::ViewTreeConnection; +using mus::Window; +using mus::WindowTreeConnection; namespace web_view { @@ -132,7 +132,7 @@ class TestFrameClient : public mojom::FrameClient { // mojom::FrameClient: void OnConnect(mojom::FramePtr frame, uint32_t change_id, - uint32_t view_id, + uint32_t window_id, mojom::ViewConnectType view_connect_type, mojo::Array<mojom::FrameDataPtr> frames, int64_t navigation_start_time_ticks, @@ -216,7 +216,7 @@ class FrameTest; // a single FrameClient. In other words this maintains the data structures // needed to represent a client side frame. To obtain one use // FrameTest::WaitForViewAndFrame(). -class ViewAndFrame : public mus::ViewTreeDelegate { +class ViewAndFrame : public mus::WindowTreeDelegate { public: ~ViewAndFrame() override { if (view_) @@ -224,7 +224,7 @@ class ViewAndFrame : public mus::ViewTreeDelegate { } // The View associated with the frame. - mus::View* view() { return view_; } + mus::Window* view() { return view_; } TestFrameClient* test_frame_client() { return &test_frame_tree_client_; } mojom::Frame* server_frame() { return test_frame_tree_client_.server_frame(); @@ -236,7 +236,7 @@ class ViewAndFrame : public mus::ViewTreeDelegate { ViewAndFrame() : view_(nullptr), frame_client_binding_(&test_frame_tree_client_) {} - void set_view(View* view) { view_ = view; } + void set_view(Window* view) { view_ = view; } // Runs a message loop until the view and frame data have been received. void WaitForViewAndFrame() { run_loop_.Run(); } @@ -265,16 +265,16 @@ class ViewAndFrame : public mus::ViewTreeDelegate { run_loop_.Quit(); } - // Overridden from ViewTreeDelegate: - void OnEmbed(View* root) override { + // Overridden from WindowTreeDelegate: + void OnEmbed(Window* root) override { view_ = root; QuitRunLoopIfNecessary(); } - void OnConnectionLost(ViewTreeConnection* connection) override { + void OnConnectionLost(WindowTreeConnection* connection) override { view_ = nullptr; } - mus::View* view_; + mus::Window* view_; base::RunLoop run_loop_; TestFrameClient test_frame_tree_client_; mojo::Binding<mojom::FrameClient> frame_client_binding_; @@ -284,18 +284,18 @@ class ViewAndFrame : public mus::ViewTreeDelegate { class FrameTest : public mojo::test::ApplicationTestBase, public mojo::ApplicationDelegate, - public mus::ViewTreeDelegate, + public mus::WindowTreeDelegate, public mojo::InterfaceFactory<mojo::ViewTreeClient>, public mojo::InterfaceFactory<mojom::FrameClient> { public: FrameTest() : most_recent_connection_(nullptr), window_manager_(nullptr) {} - ViewTreeConnection* most_recent_connection() { + WindowTreeConnection* most_recent_connection() { return most_recent_connection_; } protected: - ViewTreeConnection* window_manager() { return window_manager_; } + WindowTreeConnection* window_manager() { return window_manager_; } TestFrameTreeDelegate* frame_tree_delegate() { return frame_tree_delegate_.get(); } @@ -320,7 +320,8 @@ class FrameTest : public mojo::test::ApplicationTestBase, // Creates a new shared frame as a child of |parent|. scoped_ptr<ViewAndFrame> CreateChildViewAndFrame(ViewAndFrame* parent) { - mus::View* child_frame_view = parent->view()->connection()->CreateView(); + mus::Window* child_frame_view = + parent->view()->connection()->CreateWindow(); parent->view()->AddChild(child_frame_view); scoped_ptr<ViewAndFrame> view_and_frame(new ViewAndFrame); @@ -357,18 +358,18 @@ class FrameTest : public mojo::test::ApplicationTestBase, return true; } - // Overridden from ViewTreeDelegate: - void OnEmbed(View* root) override { + // Overridden from WindowTreeDelegate: + void OnEmbed(Window* root) override { most_recent_connection_ = root->connection(); QuitRunLoop(); } - void OnConnectionLost(ViewTreeConnection* connection) override {} + void OnConnectionLost(WindowTreeConnection* connection) override {} // Overridden from testing::Test: void SetUp() override { ApplicationTestBase::SetUp(); - mus::CreateSingleViewTreeHost(application_impl(), this, &host_); + mus::CreateSingleWindowTreeHost(application_impl(), this, &host_); ASSERT_TRUE(DoRunLoopWithTimeout()); std::swap(window_manager_, most_recent_connection_); @@ -381,7 +382,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, mojom::FrameClient* frame_client = frame_connection->frame_client(); mojo::ViewTreeClientPtr view_tree_client = frame_connection->GetViewTreeClient(); - mus::View* frame_root_view = window_manager()->CreateView(); + mus::Window* frame_root_view = window_manager()->CreateWindow(); window_manager()->GetRoot()->AddChild(frame_root_view); frame_tree_.reset(new FrameTree( 0u, frame_root_view, view_tree_client.Pass(), @@ -403,13 +404,13 @@ class FrameTest : public mojo::test::ApplicationTestBase, mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojo::ViewTreeClient> request) override { if (view_and_frame_) { - mus::ViewTreeConnection::Create( + mus::WindowTreeConnection::Create( view_and_frame_.get(), request.Pass(), - mus::ViewTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); + mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } else { - mus::ViewTreeConnection::Create( + mus::WindowTreeConnection::Create( this, request.Pass(), - mus::ViewTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); + mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } } @@ -427,10 +428,10 @@ class FrameTest : public mojo::test::ApplicationTestBase, mojo::ViewTreeHostPtr host_; // Used to receive the most recent view manager loaded by an embed action. - ViewTreeConnection* most_recent_connection_; + WindowTreeConnection* most_recent_connection_; // The View Manager connection held by the window manager (app running at the // root view). - ViewTreeConnection* window_manager_; + WindowTreeConnection* window_manager_; scoped_ptr<ViewAndFrame> view_and_frame_; @@ -478,7 +479,7 @@ TEST_F(FrameTest, OnViewEmbeddedInFrameDisconnected) { scoped_ptr<ViewAndFrame> navigated_child_view_and_frame = NavigateFrame(child_view_and_frame.get()).Pass(); - // Delete the ViewTreeConnection for the child, which should trigger + // Delete the WindowTreeConnection for the child, which should trigger // notification. delete navigated_child_view_and_frame->view()->connection(); ASSERT_EQ(1u, frame_tree()->root()->children().size()); diff --git a/components/web_view/frame_tree.cc b/components/web_view/frame_tree.cc index f3b5a7c..7132739 100644 --- a/components/web_view/frame_tree.cc +++ b/components/web_view/frame_tree.cc @@ -10,7 +10,7 @@ namespace web_view { FrameTree::FrameTree(uint32_t root_app_id, - mus::View* view, + mus::Window* view, mojo::ViewTreeClientPtr view_tree_client, FrameTreeDelegate* delegate, mojom::FrameClient* root_client, @@ -49,7 +49,7 @@ Frame* FrameTree::CreateChildFrame( mojom::FrameClient* raw_client = client.get(); scoped_ptr<FrameUserData> user_data = delegate_->CreateUserDataForNewFrame(client.Pass()); - mus::View* frame_view = root_->view()->GetChildById(frame_id); + mus::Window* frame_view = root_->view()->GetChildById(frame_id); // |frame_view| may be null if the View hasn't been created yet. If this is // the case the View will be connected to the Frame in Frame::OnTreeChanged. Frame* frame = diff --git a/components/web_view/frame_tree.h b/components/web_view/frame_tree.h index 10d5df9..f252ceb 100644 --- a/components/web_view/frame_tree.h +++ b/components/web_view/frame_tree.h @@ -37,7 +37,7 @@ class FrameTree { // |root_app_id| is a unique identifier of the app providing |root_client|. // See Frame for details on app id's. FrameTree(uint32_t root_app_id, - mus::View* view, + mus::Window* view, mojo::ViewTreeClientPtr view_tree_client, FrameTreeDelegate* delegate, mojom::FrameClient* root_client, @@ -74,7 +74,7 @@ class FrameTree { const mojo::String& name, const mojo::Array<uint8_t>& value); - mus::View* view_; + mus::Window* view_; FrameTreeDelegate* delegate_; diff --git a/components/web_view/frame_tree_delegate.cc b/components/web_view/frame_tree_delegate.cc index c04ec70..dbc3773 100644 --- a/components/web_view/frame_tree_delegate.cc +++ b/components/web_view/frame_tree_delegate.cc @@ -8,7 +8,7 @@ namespace web_view { void FrameTreeDelegate::DidCreateFrame(Frame* frame) {} void FrameTreeDelegate::DidDestroyFrame(Frame* frame) {} -void FrameTreeDelegate::OnViewEmbeddedInFrameDisconnected(Frame* frame) {} +void FrameTreeDelegate::OnWindowEmbeddedInFrameDisconnected(Frame* frame) {} void FrameTreeDelegate::OnFindInFrameCountUpdated(int32_t request_id, Frame* frame, int32_t count, diff --git a/components/web_view/frame_tree_delegate.h b/components/web_view/frame_tree_delegate.h index 4b317a7..55be561 100644 --- a/components/web_view/frame_tree_delegate.h +++ b/components/web_view/frame_tree_delegate.h @@ -86,7 +86,7 @@ class FrameTreeDelegate { // . The app is still alive, but is shutting down. // Frame does nothing in response to this, but the delegate may wish to take // action. - virtual void OnViewEmbeddedInFrameDisconnected(Frame* frame); + virtual void OnWindowEmbeddedInFrameDisconnected(Frame* frame); // Reports the current find state back to our owner. virtual void OnFindInFrameCountUpdated(int32_t request_id, diff --git a/components/web_view/public/cpp/web_view.cc b/components/web_view/public/cpp/web_view.cc index d2ae310..51fd1d6 100644 --- a/components/web_view/public/cpp/web_view.cc +++ b/components/web_view/public/cpp/web_view.cc @@ -5,7 +5,7 @@ #include "components/web_view/public/cpp/web_view.h" #include "base/bind.h" -#include "components/mus/public/cpp/view.h" +#include "components/mus/public/cpp/window.h" #include "mojo/application/public/cpp/application_impl.h" namespace web_view { @@ -20,7 +20,7 @@ void OnEmbed(bool success, uint16 connection_id) { WebView::WebView(mojom::WebViewClient* client) : binding_(client) {} WebView::~WebView() {} -void WebView::Init(mojo::ApplicationImpl* app, mus::View* view) { +void WebView::Init(mojo::ApplicationImpl* app, mus::Window* window) { mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = "mojo:web_view"; @@ -35,8 +35,8 @@ void WebView::Init(mojo::ApplicationImpl* app, mus::View* view) { mojo::ViewTreeClientPtr view_tree_client; web_view_->GetViewTreeClient(GetProxy(&view_tree_client)); - view->Embed(view_tree_client.Pass(), mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT, - base::Bind(&OnEmbed)); + window->Embed(view_tree_client.Pass(), + mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT, base::Bind(&OnEmbed)); } } // namespace web_view diff --git a/components/web_view/public/cpp/web_view.h b/components/web_view/public/cpp/web_view.h index b10c0d3..0eae5ed 100644 --- a/components/web_view/public/cpp/web_view.h +++ b/components/web_view/public/cpp/web_view.h @@ -15,7 +15,7 @@ class ApplicationImpl; } namespace mus { -class View; +class Window; } namespace web_view { @@ -25,7 +25,7 @@ class WebView { explicit WebView(mojom::WebViewClient* client); ~WebView(); - void Init(mojo::ApplicationImpl* app, mus::View* view); + void Init(mojo::ApplicationImpl* app, mus::Window* window); mojom::WebView* web_view() { return web_view_.get(); } diff --git a/components/web_view/test_frame_tree_delegate.cc b/components/web_view/test_frame_tree_delegate.cc index 2b7ee8cc..8c439b2 100644 --- a/components/web_view/test_frame_tree_delegate.cc +++ b/components/web_view/test_frame_tree_delegate.cc @@ -98,7 +98,7 @@ void TestFrameTreeDelegate::DidDestroyFrame(Frame* frame) { } } -void TestFrameTreeDelegate::OnViewEmbeddedInFrameDisconnected(Frame* frame) { +void TestFrameTreeDelegate::OnWindowEmbeddedInFrameDisconnected(Frame* frame) { if (waiting_for_frame_disconnected_ == frame) { waiting_for_frame_disconnected_ = nullptr; run_loop_->Quit(); diff --git a/components/web_view/test_frame_tree_delegate.h b/components/web_view/test_frame_tree_delegate.h index 1f021ee..21cb581 100644 --- a/components/web_view/test_frame_tree_delegate.h +++ b/components/web_view/test_frame_tree_delegate.h @@ -33,7 +33,7 @@ class TestFrameTreeDelegate : public FrameTreeDelegate { // Waits for DidDestroyFrame() to be called with |frame|. void WaitForDestroyFrame(Frame* frame); - // Waits for OnViewEmbeddedInFrameDisconnected() to be called with |frame|. + // Waits for OnWindowEmbeddedInFrameDisconnected() to be called with |frame|. void WaitForFrameDisconnected(Frame* frame); // TestFrameTreeDelegate: @@ -53,7 +53,7 @@ class TestFrameTreeDelegate : public FrameTreeDelegate { void DidNavigateLocally(Frame* source, const GURL& url) override; void DidCreateFrame(Frame* frame) override; void DidDestroyFrame(Frame* frame) override; - void OnViewEmbeddedInFrameDisconnected(Frame* frame) override; + void OnWindowEmbeddedInFrameDisconnected(Frame* frame) override; private: bool is_waiting() const { return run_loop_.get(); } diff --git a/components/web_view/test_runner/test_runner_application_delegate.cc b/components/web_view/test_runner/test_runner_application_delegate.cc index 24d2c51..76e5bc4 100644 --- a/components/web_view/test_runner/test_runner_application_delegate.cc +++ b/components/web_view/test_runner/test_runner_application_delegate.cc @@ -15,10 +15,10 @@ #include "base/path_service.h" #include "base/thread_task_runner_handle.h" #include "base/threading/thread_restrictions.h" -#include "components/mus/public/cpp/scoped_view_ptr.h" -#include "components/mus/public/cpp/view.h" -#include "components/mus/public/cpp/view_tree_connection.h" -#include "components/mus/public/cpp/view_tree_host_factory.h" +#include "components/mus/public/cpp/scoped_window_ptr.h" +#include "components/mus/public/cpp/window.h" +#include "components/mus/public/cpp/window_tree_connection.h" +#include "components/mus/public/cpp/window_tree_host_factory.h" #include "components/test_runner/blink_test_platform_support.h" #include "mojo/application/public/cpp/application_connection.h" #include "mojo/application/public/cpp/application_impl.h" @@ -40,7 +40,7 @@ TestRunnerApplicationDelegate::TestRunnerApplicationDelegate() TestRunnerApplicationDelegate::~TestRunnerApplicationDelegate() { if (root_) - mus::ScopedViewPtr::DeleteViewOrViewManager(root_); + mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_); } void TestRunnerApplicationDelegate::LaunchURL(const GURL& test_url) { @@ -55,7 +55,7 @@ void TestRunnerApplicationDelegate::LaunchURL(const GURL& test_url) { void TestRunnerApplicationDelegate::Terminate() { if (root_) - mus::ScopedViewPtr::DeleteViewOrViewManager(root_); + mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_); } //////////////////////////////////////////////////////////////////////////////// @@ -66,7 +66,7 @@ void TestRunnerApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { NOTREACHED() << "Test environment could not be properly set up for blink."; } app_ = app; - mus::CreateSingleViewTreeHost(app_, this, &host_); + mus::CreateSingleWindowTreeHost(app_, this, &host_); } bool TestRunnerApplicationDelegate::ConfigureIncomingConnection( @@ -78,7 +78,7 @@ bool TestRunnerApplicationDelegate::ConfigureIncomingConnection( //////////////////////////////////////////////////////////////////////////////// // mus::ViewTreeDelegate implementation: -void TestRunnerApplicationDelegate::OnEmbed(mus::View* root) { +void TestRunnerApplicationDelegate::OnEmbed(mus::Window* root) { root_ = root; // If this is a sys-check, then terminate in the next cycle. @@ -94,7 +94,7 @@ void TestRunnerApplicationDelegate::OnEmbed(mus::View* root) { const gfx::Size kViewportSize(800, 600); host_->SetSize(mojo::Size::From(kViewportSize)); - content_ = root_->connection()->CreateView(); + content_ = root_->connection()->CreateWindow(); root_->AddChild(content_); content_->SetBounds(*mojo::Rect::From(gfx::Rect(kViewportSize))); content_->SetVisible(true); @@ -111,7 +111,7 @@ void TestRunnerApplicationDelegate::OnEmbed(mus::View* root) { } void TestRunnerApplicationDelegate::OnConnectionLost( - mus::ViewTreeConnection* connection) { + mus::WindowTreeConnection* connection) { root_ = nullptr; app_->Quit(); } diff --git a/components/web_view/test_runner/test_runner_application_delegate.h b/components/web_view/test_runner/test_runner_application_delegate.h index 03d5b5e..6299580 100644 --- a/components/web_view/test_runner/test_runner_application_delegate.h +++ b/components/web_view/test_runner/test_runner_application_delegate.h @@ -7,7 +7,7 @@ #include "base/command_line.h" #include "base/memory/scoped_ptr.h" -#include "components/mus/public/cpp/view_tree_delegate.h" +#include "components/mus/public/cpp/window_tree_delegate.h" #include "components/mus/public/interfaces/view_tree_host.mojom.h" #include "components/test_runner/test_info_extractor.h" #include "components/web_view/public/cpp/web_view.h" @@ -27,7 +27,7 @@ namespace web_view { class TestRunnerApplicationDelegate : public mojo::ApplicationDelegate, - public mus::ViewTreeDelegate, + public mus::WindowTreeDelegate, public mojom::WebViewClient, public LayoutTestRunner, public mojo::InterfaceFactory<LayoutTestRunner> { @@ -44,9 +44,9 @@ class TestRunnerApplicationDelegate bool ConfigureIncomingConnection( mojo::ApplicationConnection* connection) override; - // mus::ViewTreeDelegate: - void OnEmbed(mus::View* root) override; - void OnConnectionLost(mus::ViewTreeConnection* connection) override; + // mus::WindowTreeDelegate: + void OnEmbed(mus::Window* root) override; + void OnConnectionLost(mus::WindowTreeConnection* connection) override; // mojom::WebViewClient: void TopLevelNavigateRequest(mojo::URLRequestPtr request) override; @@ -71,8 +71,8 @@ class TestRunnerApplicationDelegate mojo::ApplicationImpl* app_; mojo::ViewTreeHostPtr host_; - mus::View* root_; - mus::View* content_; + mus::Window* root_; + mus::Window* content_; scoped_ptr<WebView> web_view_; scoped_ptr<test_runner::TestInfoExtractor> test_extractor_; diff --git a/components/web_view/web_view_apptest.cc b/components/web_view/web_view_apptest.cc index 05faf55..63e42da 100644 --- a/components/web_view/web_view_apptest.cc +++ b/components/web_view/web_view_apptest.cc @@ -10,10 +10,10 @@ #include "base/logging.h" #include "base/path_service.h" #include "base/run_loop.h" -#include "components/mus/public/cpp/scoped_view_ptr.h" -#include "components/mus/public/cpp/tests/view_manager_test_base.h" -#include "components/mus/public/cpp/view.h" -#include "components/mus/public/cpp/view_tree_connection.h" +#include "components/mus/public/cpp/scoped_window_ptr.h" +#include "components/mus/public/cpp/tests/window_server_test_base.h" +#include "components/mus/public/cpp/window.h" +#include "components/mus/public/cpp/window_tree_connection.h" #include "mojo/util/filename_util.h" #include "url/gurl.h" @@ -40,7 +40,7 @@ GURL GetTestFileURL(const std::string& file) { } } -class WebViewTest : public mus::ViewManagerTestBase, +class WebViewTest : public mus::WindowServerTestBase, public mojom::WebViewClient { public: WebViewTest() @@ -94,25 +94,26 @@ class WebViewTest : public mus::ViewManagerTestBase, // Overridden from ApplicationDelegate: void Initialize(mojo::ApplicationImpl* app) override { - ViewManagerTestBase::Initialize(app); + WindowServerTestBase::Initialize(app); app_ = app; } // Overridden from ViewTreeDelegate: - void OnEmbed(mus::View* root) override { - content_ = root->connection()->CreateView(); + void OnEmbed(mus::Window* root) override { + content_ = root->connection()->CreateWindow(); content_->SetBounds(root->bounds()); root->AddChild(content_); content_->SetVisible(true); web_view_.Init(app_, content_); - ViewManagerTestBase::OnEmbed(root); + WindowServerTestBase::OnEmbed(root); } void TearDown() override { - mus::ScopedViewPtr::DeleteViewOrViewManager(window_manager()->GetRoot()); - ViewManagerTestBase::TearDown(); + mus::ScopedWindowPtr::DeleteWindowOrWindowManager( + window_manager()->GetRoot()); + WindowServerTestBase::TearDown(); } // Overridden from web_view::mojom::WebViewClient: @@ -148,7 +149,7 @@ class WebViewTest : public mus::ViewManagerTestBase, mojo::ApplicationImpl* app_; - mus::View* content_; + mus::Window* content_; web_view::WebView web_view_; diff --git a/components/web_view/web_view_impl.cc b/components/web_view/web_view_impl.cc index cb0078a..b590e0f 100644 --- a/components/web_view/web_view_impl.cc +++ b/components/web_view/web_view_impl.cc @@ -9,9 +9,9 @@ #include "base/bind.h" #include "base/command_line.h" #include "components/devtools_service/public/cpp/switches.h" -#include "components/mus/public/cpp/scoped_view_ptr.h" -#include "components/mus/public/cpp/view.h" -#include "components/mus/public/cpp/view_tree_connection.h" +#include "components/mus/public/cpp/scoped_window_ptr.h" +#include "components/mus/public/cpp/window.h" +#include "components/mus/public/cpp/window_tree_connection.h" #include "components/web_view/client_initiated_frame_connection.h" #include "components/web_view/frame.h" #include "components/web_view/frame_connection.h" @@ -59,7 +59,7 @@ WebViewImpl::~WebViewImpl() { content_->RemoveObserver(this); if (root_) { root_->RemoveObserver(this); - mus::ScopedViewPtr::DeleteViewOrViewManager(root_); + mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_); } } @@ -74,7 +74,7 @@ void WebViewImpl::OnLoad(const GURL& pending_url) { client_->TopLevelNavigationStarted(pending_url.spec()); - content_ = root_->connection()->CreateView(); + content_ = root_->connection()->CreateWindow(); content_->SetBounds(*mojo::Rect::From( gfx::Rect(0, 0, root_->bounds().width, root_->bounds().height))); root_->AddChild(content_); @@ -119,9 +119,9 @@ void WebViewImpl::LoadRequest(mojo::URLRequestPtr request) { void WebViewImpl::GetViewTreeClient( mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) { - mus::ViewTreeConnection::Create( + mus::WindowTreeConnection::Create( this, view_tree_client.Pass(), - mus::ViewTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); + mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } void WebViewImpl::Find(const mojo::String& search_text, @@ -146,9 +146,9 @@ void WebViewImpl::GoForward() { } //////////////////////////////////////////////////////////////////////////////// -// WebViewImpl, mus::ViewTreeDelegate implementation: +// WebViewImpl, mus::WindowTreeDelegate implementation: -void WebViewImpl::OnEmbed(mus::View* root) { +void WebViewImpl::OnEmbed(mus::Window* root) { // We must have been granted embed root priviledges, otherwise we can't // Embed() in any descendants. DCHECK(root->connection()->IsEmbedRoot()); @@ -159,16 +159,16 @@ void WebViewImpl::OnEmbed(mus::View* root) { OnLoad(pending_load_->pending_url()); } -void WebViewImpl::OnConnectionLost(mus::ViewTreeConnection* connection) { +void WebViewImpl::OnConnectionLost(mus::WindowTreeConnection* connection) { root_ = nullptr; } //////////////////////////////////////////////////////////////////////////////// // WebViewImpl, mus::ViewObserver implementation: -void WebViewImpl::OnViewBoundsChanged(mus::View* view, - const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) { +void WebViewImpl::OnWindowBoundsChanged(mus::Window* view, + const mojo::Rect& old_bounds, + const mojo::Rect& new_bounds) { if (view != content_) { mojo::Rect rect; rect.width = new_bounds.width; @@ -178,7 +178,7 @@ void WebViewImpl::OnViewBoundsChanged(mus::View* view, } } -void WebViewImpl::OnViewDestroyed(mus::View* view) { +void WebViewImpl::OnWindowDestroyed(mus::Window* view) { // |FrameTree| cannot outlive the content view. if (view == content_) { frame_tree_.reset(); diff --git a/components/web_view/web_view_impl.h b/components/web_view/web_view_impl.h index 534c5aa..1e2125e 100644 --- a/components/web_view/web_view_impl.h +++ b/components/web_view/web_view_impl.h @@ -10,8 +10,8 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" -#include "components/mus/public/cpp/view_observer.h" -#include "components/mus/public/cpp/view_tree_delegate.h" +#include "components/mus/public/cpp/window_observer.h" +#include "components/mus/public/cpp/window_tree_delegate.h" #include "components/web_view/find_controller.h" #include "components/web_view/find_controller_delegate.h" #include "components/web_view/frame_devtools_agent_delegate.h" @@ -39,8 +39,8 @@ class HTMLMessageEvent; } class WebViewImpl : public mojom::WebView, - public mus::ViewTreeDelegate, - public mus::ViewObserver, + public mus::WindowTreeDelegate, + public mus::WindowObserver, public FrameTreeDelegate, public FrameDevToolsAgentDelegate, public NavigationControllerDelegate, @@ -70,15 +70,15 @@ class WebViewImpl : public mojom::WebView, void GoBack() override; void GoForward() override; - // Overridden from mus::ViewTreeDelegate: - void OnEmbed(mus::View* root) override; - void OnConnectionLost(mus::ViewTreeConnection* connection) override; + // Overridden from mus::WindowTreeDelegate: + void OnEmbed(mus::Window* root) override; + void OnConnectionLost(mus::WindowTreeConnection* connection) override; - // Overridden from mus::ViewObserver: - void OnViewBoundsChanged(mus::View* view, - const mojo::Rect& old_bounds, - const mojo::Rect& new_bounds) override; - void OnViewDestroyed(mus::View* view) override; + // Overridden from mus::WindowObserver: + void OnWindowBoundsChanged(mus::Window* view, + const mojo::Rect& old_bounds, + const mojo::Rect& new_bounds) override; + void OnWindowDestroyed(mus::Window* view) override; // Overridden from FrameTreeDelegate: scoped_ptr<FrameUserData> CreateUserDataForNewFrame( @@ -118,8 +118,8 @@ class WebViewImpl : public mojom::WebView, mojo::ApplicationImpl* app_; mojom::WebViewClientPtr client_; mojo::StrongBinding<WebView> binding_; - mus::View* root_; - mus::View* content_; + mus::Window* root_; + mus::Window* content_; scoped_ptr<FrameTree> frame_tree_; // When LoadRequest() is called a PendingWebViewLoad is created to wait for |