| 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/web_view_impl.h" | 5 #include "components/web_view/web_view_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "components/devtools_service/public/cpp/switches.h" | 8 #include "components/devtools_service/public/cpp/switches.h" |
| 9 #include "components/view_manager/public/cpp/scoped_view_ptr.h" | 9 #include "components/view_manager/public/cpp/scoped_view_ptr.h" |
| 10 #include "components/view_manager/public/cpp/view.h" | 10 #include "components/view_manager/public/cpp/view.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 void WebViewImpl::GetViewTreeClient( | 86 void WebViewImpl::GetViewTreeClient( |
| 87 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) { | 87 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) { |
| 88 mojo::ViewTreeConnection::Create(this, view_tree_client.Pass()); | 88 mojo::ViewTreeConnection::Create(this, view_tree_client.Pass()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 //////////////////////////////////////////////////////////////////////////////// | 91 //////////////////////////////////////////////////////////////////////////////// |
| 92 // WebViewImpl, mojo::ViewTreeDelegate implementation: | 92 // WebViewImpl, mojo::ViewTreeDelegate implementation: |
| 93 | 93 |
| 94 void WebViewImpl::OnEmbed(mojo::View* root) { | 94 void WebViewImpl::OnEmbed(mojo::View* root) { |
| 95 root->connection()->SetEmbedRoot(); | 95 // We must have been granted embed root priviledges, otherwise we can't |
| 96 // Embed() in any descendants. |
| 97 DCHECK(root->connection()->IsEmbedRoot()); |
| 96 root->AddObserver(this); | 98 root->AddObserver(this); |
| 97 root_ = root; | 99 root_ = root; |
| 98 content_ = root->connection()->CreateView(); | 100 content_ = root->connection()->CreateView(); |
| 99 content_->SetBounds(*mojo::Rect::From(gfx::Rect(0, 0, root->bounds().width, | 101 content_->SetBounds(*mojo::Rect::From(gfx::Rect(0, 0, root->bounds().width, |
| 100 root->bounds().height))); | 102 root->bounds().height))); |
| 101 root->AddChild(content_); | 103 root->AddChild(content_); |
| 102 content_->SetVisible(true); | 104 content_->SetVisible(true); |
| 103 content_->AddObserver(this); | 105 content_->AddObserver(this); |
| 104 | 106 |
| 105 if (pending_load_ && pending_load_->is_content_handler_id_valid()) | 107 if (pending_load_ && pending_load_->is_content_handler_id_valid()) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 //////////////////////////////////////////////////////////////////////////////// | 171 //////////////////////////////////////////////////////////////////////////////// |
| 170 // WebViewImpl, FrameDevToolsAgentDelegate implementation: | 172 // WebViewImpl, FrameDevToolsAgentDelegate implementation: |
| 171 | 173 |
| 172 void WebViewImpl::HandlePageNavigateRequest(const GURL& url) { | 174 void WebViewImpl::HandlePageNavigateRequest(const GURL& url) { |
| 173 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 175 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 174 request->url = url.spec(); | 176 request->url = url.spec(); |
| 175 client_->TopLevelNavigate(request.Pass()); | 177 client_->TopLevelNavigate(request.Pass()); |
| 176 } | 178 } |
| 177 | 179 |
| 178 } // namespace web_view | 180 } // namespace web_view |
| OLD | NEW |