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

Side by Side Diff: mandoline/tab/frame.cc

Issue 1270313006: Connects PostMessage() for OOPIFs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix windows Created 5 years, 4 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
« no previous file with comments | « mandoline/tab/frame.h ('k') | mandoline/tab/frame_apptest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "mandoline/tab/frame.h" 5 #include "mandoline/tab/frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 165
166 void Frame::SetView(mojo::View* view) { 166 void Frame::SetView(mojo::View* view) {
167 DCHECK(!view_); 167 DCHECK(!view_);
168 DCHECK_EQ(id_, view->id()); 168 DCHECK_EQ(id_, view->id());
169 view_ = view; 169 view_ = view;
170 view_->SetLocalProperty(kFrame, this); 170 view_->SetLocalProperty(kFrame, this);
171 view_->AddObserver(this); 171 view_->AddObserver(this);
172 } 172 }
173 173
174 Frame* Frame::GetAncestorWithFrameTreeClient() {
175 Frame* frame = this;
176 while (frame && !frame->frame_tree_client_)
177 frame = frame->parent_;
178 return frame;
179 }
180
174 void Frame::BuildFrameTree(std::vector<const Frame*>* frames) const { 181 void Frame::BuildFrameTree(std::vector<const Frame*>* frames) const {
175 frames->push_back(this); 182 frames->push_back(this);
176 for (const Frame* frame : children_) 183 for (const Frame* frame : children_)
177 frame->BuildFrameTree(frames); 184 frame->BuildFrameTree(frames);
178 } 185 }
179 186
180 void Frame::Add(Frame* node) { 187 void Frame::Add(Frame* node) {
181 DCHECK(!node->parent_); 188 DCHECK(!node->parent_);
182 189
183 node->parent_ = this; 190 node->parent_ = this;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // TODO(sky): Change browser to create a child for each FrameTree. 307 // TODO(sky): Change browser to create a child for each FrameTree.
301 if (tree_->root() == this) { 308 if (tree_->root() == this) {
302 view_->RemoveObserver(this); 309 view_->RemoveObserver(this);
303 view_ = nullptr; 310 view_ = nullptr;
304 return; 311 return;
305 } 312 }
306 313
307 delete this; 314 delete this;
308 } 315 }
309 316
310 void Frame::PostMessageEventToFrame(uint32_t frame_id, MessageEventPtr event) { 317 void Frame::PostMessageEventToFrame(uint32_t source_frame_id,
311 Frame* target = tree_->root()->FindFrame(frame_id); 318 uint32_t target_frame_id,
312 if (!target || 319 HTMLMessageEventPtr event) {
313 !tree_->delegate_->CanPostMessageEventToFrame(this, target, event.get())) 320 Frame* source = tree_->root()->FindFrame(source_frame_id);
321 Frame* target = tree_->root()->FindFrame(target_frame_id);
322 if (!target || !source || source == target || !tree_->delegate_ ||
323 !tree_->delegate_->CanPostMessageEventToFrame(source, target,
324 event.get()))
314 return; 325 return;
315 326
316 NOTIMPLEMENTED(); 327 DCHECK(target->GetAncestorWithFrameTreeClient());
328 target->GetAncestorWithFrameTreeClient()->frame_tree_client_->PostMessage(
329 source_frame_id, target_frame_id, event.Pass());
317 } 330 }
318 331
319 void Frame::LoadingStarted(uint32_t frame_id) { 332 void Frame::LoadingStarted(uint32_t frame_id) {
320 Frame* target_frame = FindTargetFrame(frame_id); 333 Frame* target_frame = FindTargetFrame(frame_id);
321 if (target_frame) 334 if (target_frame)
322 target_frame->LoadingStartedImpl(); 335 target_frame->LoadingStartedImpl();
323 } 336 }
324 337
325 void Frame::LoadingStopped(uint32_t frame_id) { 338 void Frame::LoadingStopped(uint32_t frame_id) {
326 Frame* target_frame = FindTargetFrame(frame_id); 339 Frame* target_frame = FindTargetFrame(frame_id);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 tree_->delegate_->RequestNavigate(this, target_type, target_frame, 392 tree_->delegate_->RequestNavigate(this, target_type, target_frame,
380 request.Pass()); 393 request.Pass());
381 } 394 }
382 } 395 }
383 396
384 void Frame::DidNavigateLocally(uint32_t frame_id, const mojo::String& url) { 397 void Frame::DidNavigateLocally(uint32_t frame_id, const mojo::String& url) {
385 NOTIMPLEMENTED(); 398 NOTIMPLEMENTED();
386 } 399 }
387 400
388 } // namespace mandoline 401 } // namespace mandoline
OLDNEW
« no previous file with comments | « mandoline/tab/frame.h ('k') | mandoline/tab/frame_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698