| 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_connection.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 "mojo/converters/geometry/geometry_type_converters.h" | |
| 12 #include "ui/views/controls/webview/webview.h" | 11 #include "ui/views/controls/webview/webview.h" |
| 13 #include "ui/views/mus/native_widget_mus.h" | 12 #include "ui/views/mus/native_widget_mus.h" |
| 14 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 15 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 16 | 15 |
| 17 namespace navigation { | 16 namespace navigation { |
| 18 | 17 |
| 19 ViewImpl::ViewImpl(shell::Connector* connector, | 18 ViewImpl::ViewImpl(shell::Connector* connector, |
| 20 content::BrowserContext* browser_context, | 19 content::BrowserContext* browser_context, |
| 21 mojom::ViewClientPtr client, | 20 mojom::ViewClientPtr client, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 void ViewImpl::AddNewContents(content::WebContents* source, | 63 void ViewImpl::AddNewContents(content::WebContents* source, |
| 65 content::WebContents* new_contents, | 64 content::WebContents* new_contents, |
| 66 WindowOpenDisposition disposition, | 65 WindowOpenDisposition disposition, |
| 67 const gfx::Rect& initial_rect, | 66 const gfx::Rect& initial_rect, |
| 68 bool user_gesture, | 67 bool user_gesture, |
| 69 bool* was_blocked) { | 68 bool* was_blocked) { |
| 70 mojom::ViewClientPtr client; | 69 mojom::ViewClientPtr client; |
| 71 mojom::ViewPtr view; | 70 mojom::ViewPtr view; |
| 72 mojom::ViewRequest view_request = GetProxy(&view); | 71 mojom::ViewRequest view_request = GetProxy(&view); |
| 73 client_->ViewCreated(std::move(view), GetProxy(&client), | 72 client_->ViewCreated(std::move(view), GetProxy(&client), |
| 74 disposition == NEW_POPUP, mojo::Rect::From(initial_rect), | 73 disposition == NEW_POPUP, initial_rect, user_gesture); |
| 75 user_gesture); | |
| 76 ViewImpl* impl = | 74 ViewImpl* impl = |
| 77 new ViewImpl(connector_, new_contents->GetBrowserContext(), | 75 new ViewImpl(connector_, new_contents->GetBrowserContext(), |
| 78 std::move(client), std::move(view_request), ref_->Clone()); | 76 std::move(client), std::move(view_request), ref_->Clone()); |
| 79 // TODO(beng): This is a bit crappy. should be able to create the ViewImpl | 77 // TODO(beng): This is a bit crappy. should be able to create the ViewImpl |
| 80 // with |new_contents| instead. | 78 // with |new_contents| instead. |
| 81 impl->web_view_->SetWebContents(new_contents); | 79 impl->web_view_->SetWebContents(new_contents); |
| 82 impl->web_view_->GetWebContents()->SetDelegate(impl); | 80 impl->web_view_->GetWebContents()->SetDelegate(impl); |
| 83 | 81 |
| 84 // TODO(beng): this reply is currently synchronous, figure out a fix. | 82 // TODO(beng): this reply is currently synchronous, figure out a fix. |
| 85 if (was_blocked) | 83 if (was_blocked) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |