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

Unified Diff: content/browser/browsing_instance_frame_id.cc

Issue 8760024: Cross-process postMessage (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/browsing_instance_frame_id.cc
diff --git a/content/browser/browsing_instance_frame_id.cc b/content/browser/browsing_instance_frame_id.cc
new file mode 100644
index 0000000000000000000000000000000000000000..08711eb2d113e0d284eeca2e042ddee762f83639
--- /dev/null
+++ b/content/browser/browsing_instance_frame_id.cc
@@ -0,0 +1,54 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+// Author: supersat@google.com (Karl Koscher)
Charlie Reis 2011/12/01 23:13:02 Nit: wrong template.
supersat 2011/12/09 23:08:20 Done.
+
+#include "browsing_instance_frame_id.h"
+
+namespace content {
+
+BrowsingInstanceFrame::WebKitFrameIdTuple::WebKitFrameIdTuple(int proc_host_id,
+ int64 frame_id)
+ : process_host_id(proc_host_id),
+ frame_id(frame_id) {
+}
+
+bool BrowsingInstanceFrame::WebKitFrameIdTuple::operator==(
+ const WebKitFrameIdTuple& o) const {
+ return o.process_host_id == process_host_id &&
+ o.frame_id == frame_id;
+}
+
+BrowsingInstanceFrame::BrowsingInstanceFrame(int64 id, bool is_top_level)
+ : id_(id),
+ current_webkit_frame_(WebKitFrameIdTuple(-1, -1)),
+ current_route_id_(-1),
+ is_top_level_(is_top_level) {
+}
+
+BrowsingInstanceFrame::~BrowsingInstanceFrame() {
+}
+
+void BrowsingInstanceFrame::UpdateFrame(int new_process_host_id,
+ int new_route_id,
+ int64 new_frame_id) {
+ current_webkit_frame_.process_host_id = new_process_host_id;
+ current_webkit_frame_.frame_id = new_frame_id;
+ current_route_id_ = new_route_id;
+ // TODO(supersat): Clear out subframes?
+}
+
+BrowsingInstanceFrame* BrowsingInstanceFrame::FindById(int64 id) {
+ if (id == id_)
+ return this;
+
+ std::list<BrowsingInstanceFrame *>::iterator iter;
+ for (iter = children_.begin(); iter != children_.end(); iter++) {
+ BrowsingInstanceFrame *retValue = (*iter)->FindById(id);
+ if (retValue) {
+ return retValue;
+ }
+ }
+
+ return 0;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698