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