| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/navigation/view_impl.h" | 5 #include "services/navigation/view_impl.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "components/mus/public/cpp/window_tree_connection.h" | 8 #include "components/mus/public/cpp/window_tree_client.h" |
| 9 #include "content/public/browser/navigation_controller.h" | 9 #include "content/public/browser/navigation_controller.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 11 #include "ui/views/controls/webview/webview.h" | 11 #include "ui/views/controls/webview/webview.h" |
| 12 #include "ui/views/mus/native_widget_mus.h" | 12 #include "ui/views/mus/native_widget_mus.h" |
| 13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace navigation { | 16 namespace navigation { |
| 17 | 17 |
| 18 ViewImpl::ViewImpl(shell::Connector* connector, | 18 ViewImpl::ViewImpl(shell::Connector* connector, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 48 else | 48 else |
| 49 web_view_->GetWebContents()->GetController().ReloadBypassingCache(true); | 49 web_view_->GetWebContents()->GetController().ReloadBypassingCache(true); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void ViewImpl::Stop() { | 52 void ViewImpl::Stop() { |
| 53 web_view_->GetWebContents()->Stop(); | 53 web_view_->GetWebContents()->Stop(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void ViewImpl::GetWindowTreeClient( | 56 void ViewImpl::GetWindowTreeClient( |
| 57 mus::mojom::WindowTreeClientRequest request) { | 57 mus::mojom::WindowTreeClientRequest request) { |
| 58 mus::WindowTreeConnection::Create( | 58 new mus::WindowTreeClient(this, nullptr, std::move(request)); |
| 59 this, std::move(request), | |
| 60 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); | |
| 61 } | 59 } |
| 62 | 60 |
| 63 void ViewImpl::AddNewContents(content::WebContents* source, | 61 void ViewImpl::AddNewContents(content::WebContents* source, |
| 64 content::WebContents* new_contents, | 62 content::WebContents* new_contents, |
| 65 WindowOpenDisposition disposition, | 63 WindowOpenDisposition disposition, |
| 66 const gfx::Rect& initial_rect, | 64 const gfx::Rect& initial_rect, |
| 67 bool user_gesture, | 65 bool user_gesture, |
| 68 bool* was_blocked) { | 66 bool* was_blocked) { |
| 69 mojom::ViewClientPtr client; | 67 mojom::ViewClientPtr client; |
| 70 mojom::ViewPtr view; | 68 mojom::ViewPtr view; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 views::Widget::InitParams params( | 110 views::Widget::InitParams params( |
| 113 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 111 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 114 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 112 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 115 params.delegate = this; | 113 params.delegate = this; |
| 116 params.native_widget = new views::NativeWidgetMus( | 114 params.native_widget = new views::NativeWidgetMus( |
| 117 widget_.get(), connector_, root, mus::mojom::SurfaceType::DEFAULT); | 115 widget_.get(), connector_, root, mus::mojom::SurfaceType::DEFAULT); |
| 118 widget_->Init(params); | 116 widget_->Init(params); |
| 119 widget_->Show(); | 117 widget_->Show(); |
| 120 } | 118 } |
| 121 | 119 |
| 122 void ViewImpl::OnConnectionLost(mus::WindowTreeConnection* connection) {} | 120 void ViewImpl::OnWindowTreeClientDestroyed(mus::WindowTreeClient* client) {} |
| 123 void ViewImpl::OnEventObserved(const ui::Event& event, mus::Window* target) {} | 121 void ViewImpl::OnEventObserved(const ui::Event& event, mus::Window* target) {} |
| 124 | 122 |
| 125 views::View* ViewImpl::GetContentsView() { | 123 views::View* ViewImpl::GetContentsView() { |
| 126 return web_view_; | 124 return web_view_; |
| 127 } | 125 } |
| 128 | 126 |
| 129 views::Widget* ViewImpl::GetWidget() { | 127 views::Widget* ViewImpl::GetWidget() { |
| 130 return web_view_->GetWidget(); | 128 return web_view_->GetWidget(); |
| 131 } | 129 } |
| 132 | 130 |
| 133 const views::Widget* ViewImpl::GetWidget() const { | 131 const views::Widget* ViewImpl::GetWidget() const { |
| 134 return web_view_->GetWidget(); | 132 return web_view_->GetWidget(); |
| 135 } | 133 } |
| 136 | 134 |
| 137 } // navigation | 135 } // navigation |
| OLD | NEW |