Index: content/browser/content_frame.h |
diff --git a/content/browser/content_frame.h b/content/browser/content_frame.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c39198e915fdd35b3a2b69ff96a6a635d75d4fec |
--- /dev/null |
+++ b/content/browser/content_frame.h |
@@ -0,0 +1,93 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_CONTENT_FRAME_H_ |
+#define CONTENT_BROWSER_CONTENT_FRAME_H_ |
+ |
+#include <list> |
+ |
+#include "base/basictypes.h" |
+#include "base/hash_tables.h" |
+#include "content/browser/tab_contents/tab_contents.h" |
+#include "content/browser/tab_contents/tab_contents_observer.h" |
+#include "content/browser/webkit_frame_identifier.h" |
+ |
+namespace content { |
+ |
+// TODO(supersat): Remove this. |
+class FrameMap; |
+class ContentFrameObserver; |
+ |
+const int64 INVALID_CONTENT_FRAME_ID = -1; |
+ |
+// This class represents a single user-visible frame and tracks all of the |
+// (potentially invisible) WebKit frames that may either be currently rendering |
+// the frame or are proxies for the frame. In conjunction with the FrameMap, |
+// this is used to route cross-process scripting calls from a proxy WebKit frame |
+// to the WebKit frame that's currently active. |
+class ContentFrame { |
+ |
+// TODO(supersat): Remove this. |
+friend class FrameMap; |
+friend class ContentFrameObserver; |
+ |
+ public: |
+ ContentFrame(int64 id, |
+ bool is_top_level, |
+ TabContents& tab_contents, |
+ ContentFrame* opener); |
+ ~ContentFrame(); |
+ |
+ int64 id() { return id_; } |
+ |
+ const WebKitFrameIdentifier active_webkit_frame() const { |
+ return active_webkit_frame_; |
+ } |
+ |
+ bool is_top_level() const { |
+ return is_top_level_; |
+ } |
+ |
+ TabContents& tab_contents() const { |
+ return tab_contents_; |
+ } |
+ |
+ // All WebKit frames that are either rendering this frame or are proxies for |
+ // this frame. |
+ const std::list<WebKitFrameIdentifier> all_webkit_frames() const { |
+ return all_webkit_frames_; |
+ } |
+ |
+ void UpdateFrame(int new_process_host_id, |
+ int new_route_id, |
+ int64 new_frame_id); |
+ |
+ ContentFrame* opener() const { |
+ return opener_; |
+ } |
+ |
+ // Child frames are subframes, and are removed when this ContentFrame |
+ // is navigated. |
+ const std::list<ContentFrame*> children() const { |
+ return children_; |
+ } |
+ |
+ void AddChildFrame(ContentFrame* child); |
+ |
+ // This does not actually delete the ContentFrames -- the caller must do this. |
+ void RemoveChildren(); |
+ |
+ private: |
+ int64 id_; |
+ WebKitFrameIdentifier active_webkit_frame_; |
+ bool is_top_level_; |
+ std::list<WebKitFrameIdentifier> all_webkit_frames_; |
+ TabContents& tab_contents_; |
+ ContentFrame* opener_; |
+ std::list<ContentFrame*> children_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_CONTENT_FRAME_H_ |