Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: components/web_view/web_view_impl.cc

Issue 1351013002: Revert of Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/mus/public/cpp/scoped_view_ptr.h" 9 #include "components/mus/public/cpp/scoped_view_ptr.h"
10 #include "components/mus/public/cpp/view.h" 10 #include "components/mus/public/cpp/view.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 content_(nullptr) { 44 content_(nullptr) {
45 if (EnableRemoteDebugging()) 45 if (EnableRemoteDebugging())
46 devtools_agent_.reset(new FrameDevToolsAgent(app_, this)); 46 devtools_agent_.reset(new FrameDevToolsAgent(app_, this));
47 } 47 }
48 48
49 WebViewImpl::~WebViewImpl() { 49 WebViewImpl::~WebViewImpl() {
50 if (content_) 50 if (content_)
51 content_->RemoveObserver(this); 51 content_->RemoveObserver(this);
52 if (root_) { 52 if (root_) {
53 root_->RemoveObserver(this); 53 root_->RemoveObserver(this);
54 mus::ScopedViewPtr::DeleteViewOrViewManager(root_); 54 mojo::ScopedViewPtr::DeleteViewOrViewManager(root_);
55 } 55 }
56 } 56 }
57 57
58 void WebViewImpl::OnLoad() { 58 void WebViewImpl::OnLoad() {
59 scoped_ptr<PendingWebViewLoad> pending_load(pending_load_.Pass()); 59 scoped_ptr<PendingWebViewLoad> pending_load(pending_load_.Pass());
60 scoped_ptr<FrameConnection> frame_connection( 60 scoped_ptr<FrameConnection> frame_connection(
61 pending_load->frame_connection()); 61 pending_load->frame_connection());
62 mojo::ViewTreeClientPtr view_tree_client = 62 mojo::ViewTreeClientPtr view_tree_client =
63 frame_connection->GetViewTreeClient(); 63 frame_connection->GetViewTreeClient();
64 64
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // target url here, when we should not add the redirect url to the back 102 // target url here, when we should not add the redirect url to the back
103 // list. 103 // list.
104 back_list_.push_back(current_page_request_.Pass()); 104 back_list_.push_back(current_page_request_.Pass());
105 } 105 }
106 106
107 LoadRequestImpl(request.Pass()); 107 LoadRequestImpl(request.Pass());
108 } 108 }
109 109
110 void WebViewImpl::GetViewTreeClient( 110 void WebViewImpl::GetViewTreeClient(
111 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) { 111 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client) {
112 mus::ViewTreeConnection::Create(this, view_tree_client.Pass()); 112 mojo::ViewTreeConnection::Create(this, view_tree_client.Pass());
113 } 113 }
114 114
115 void WebViewImpl::GoBack() { 115 void WebViewImpl::GoBack() {
116 if (back_list_.empty()) 116 if (back_list_.empty())
117 return; 117 return;
118 118
119 // Take the current page request and put it in the forward list. 119 // Take the current page request and put it in the forward list.
120 forward_list_.push_back(current_page_request_.Pass()); 120 forward_list_.push_back(current_page_request_.Pass());
121 121
122 mojo::URLRequestPtr new_request = back_list_.back()->Clone(); 122 mojo::URLRequestPtr new_request = back_list_.back()->Clone();
123 back_list_.resize(back_list_.size() - 1); 123 back_list_.resize(back_list_.size() - 1);
124 124
125 LoadRequestImpl(new_request.Pass()); 125 LoadRequestImpl(new_request.Pass());
126 } 126 }
127 127
128 void WebViewImpl::GoForward() { 128 void WebViewImpl::GoForward() {
129 if (forward_list_.empty()) 129 if (forward_list_.empty())
130 return; 130 return;
131 131
132 back_list_.push_back(current_page_request_.Pass()); 132 back_list_.push_back(current_page_request_.Pass());
133 133
134 mojo::URLRequestPtr new_request = forward_list_.back()->Clone(); 134 mojo::URLRequestPtr new_request = forward_list_.back()->Clone();
135 forward_list_.resize(forward_list_.size() - 1); 135 forward_list_.resize(forward_list_.size() - 1);
136 136
137 LoadRequestImpl(new_request.Pass()); 137 LoadRequestImpl(new_request.Pass());
138 } 138 }
139 139
140 //////////////////////////////////////////////////////////////////////////////// 140 ////////////////////////////////////////////////////////////////////////////////
141 // WebViewImpl, mus::ViewTreeDelegate implementation: 141 // WebViewImpl, mojo::ViewTreeDelegate implementation:
142 142
143 void WebViewImpl::OnEmbed(mus::View* root) { 143 void WebViewImpl::OnEmbed(mojo::View* root) {
144 // We must have been granted embed root priviledges, otherwise we can't 144 // We must have been granted embed root priviledges, otherwise we can't
145 // Embed() in any descendants. 145 // Embed() in any descendants.
146 DCHECK(root->connection()->IsEmbedRoot()); 146 DCHECK(root->connection()->IsEmbedRoot());
147 root->AddObserver(this); 147 root->AddObserver(this);
148 root_ = root; 148 root_ = root;
149 content_ = root->connection()->CreateView(); 149 content_ = root->connection()->CreateView();
150 content_->SetBounds(*mojo::Rect::From(gfx::Rect(0, 0, root->bounds().width, 150 content_->SetBounds(*mojo::Rect::From(gfx::Rect(0, 0, root->bounds().width,
151 root->bounds().height))); 151 root->bounds().height)));
152 root->AddChild(content_); 152 root->AddChild(content_);
153 content_->SetVisible(true); 153 content_->SetVisible(true);
154 content_->AddObserver(this); 154 content_->AddObserver(this);
155 155
156 if (pending_load_ && pending_load_->is_content_handler_id_valid()) 156 if (pending_load_ && pending_load_->is_content_handler_id_valid())
157 OnLoad(); 157 OnLoad();
158 } 158 }
159 159
160 void WebViewImpl::OnConnectionLost(mus::ViewTreeConnection* connection) { 160 void WebViewImpl::OnConnectionLost(mojo::ViewTreeConnection* connection) {
161 root_ = nullptr; 161 root_ = nullptr;
162 } 162 }
163 163
164 //////////////////////////////////////////////////////////////////////////////// 164 ////////////////////////////////////////////////////////////////////////////////
165 // WebViewImpl, mus::ViewObserver implementation: 165 // WebViewImpl, mojo::ViewObserver implementation:
166 166
167 void WebViewImpl::OnViewBoundsChanged(mus::View* view, 167 void WebViewImpl::OnViewBoundsChanged(mojo::View* view,
168 const mojo::Rect& old_bounds, 168 const mojo::Rect& old_bounds,
169 const mojo::Rect& new_bounds) { 169 const mojo::Rect& new_bounds) {
170 if (view != content_) { 170 if (view != content_) {
171 mojo::Rect rect; 171 mojo::Rect rect;
172 rect.width = new_bounds.width; 172 rect.width = new_bounds.width;
173 rect.height = new_bounds.height; 173 rect.height = new_bounds.height;
174 content_->SetBounds(rect); 174 content_->SetBounds(rect);
175 } 175 }
176 } 176 }
177 177
178 void WebViewImpl::OnViewDestroyed(mus::View* view) { 178 void WebViewImpl::OnViewDestroyed(mojo::View* view) {
179 // |FrameTree| cannot outlive the content view. 179 // |FrameTree| cannot outlive the content view.
180 if (view == content_) { 180 if (view == content_) {
181 frame_tree_.reset(); 181 frame_tree_.reset();
182 content_ = nullptr; 182 content_ = nullptr;
183 } 183 }
184 } 184 }
185 185
186 //////////////////////////////////////////////////////////////////////////////// 186 ////////////////////////////////////////////////////////////////////////////////
187 // WebViewImpl, FrameTreeDelegate implementation: 187 // WebViewImpl, FrameTreeDelegate implementation:
188 188
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 //////////////////////////////////////////////////////////////////////////////// 220 ////////////////////////////////////////////////////////////////////////////////
221 // WebViewImpl, FrameDevToolsAgentDelegate implementation: 221 // WebViewImpl, FrameDevToolsAgentDelegate implementation:
222 222
223 void WebViewImpl::HandlePageNavigateRequest(const GURL& url) { 223 void WebViewImpl::HandlePageNavigateRequest(const GURL& url) {
224 mojo::URLRequestPtr request(mojo::URLRequest::New()); 224 mojo::URLRequestPtr request(mojo::URLRequest::New());
225 request->url = url.spec(); 225 request->url = url.spec();
226 client_->TopLevelNavigate(request.Pass()); 226 client_->TopLevelNavigate(request.Pass());
227 } 227 }
228 228
229 } // namespace web_view 229 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/web_view_impl.h ('k') | mandoline/services/core_services/application_delegate_factory_notandroid.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698