OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_CONTENT_FRAME_H_ |
| 6 #define CONTENT_BROWSER_CONTENT_FRAME_H_ |
| 7 |
| 8 #include <list> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/hash_tables.h" |
| 12 #include "content/browser/tab_contents/tab_contents.h" |
| 13 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 14 #include "content/browser/webkit_frame_identifier.h" |
| 15 |
| 16 namespace content { |
| 17 |
| 18 // TODO(supersat): Remove this. |
| 19 class FrameMap; |
| 20 class ContentFrameObserver; |
| 21 |
| 22 const int64 INVALID_CONTENT_FRAME_ID = -1; |
| 23 |
| 24 // This class represents a single user-visible frame and tracks all of the |
| 25 // (potentially invisible) WebKit frames that may either be currently rendering |
| 26 // the frame or are proxies for the frame. In conjunction with the FrameMap, |
| 27 // this is used to route cross-process scripting calls from a proxy WebKit frame |
| 28 // to the WebKit frame that's currently active. |
| 29 class ContentFrame { |
| 30 |
| 31 // TODO(supersat): Remove this. |
| 32 friend class FrameMap; |
| 33 friend class ContentFrameObserver; |
| 34 |
| 35 public: |
| 36 ContentFrame(int64 id, |
| 37 bool is_top_level, |
| 38 TabContents& tab_contents, |
| 39 ContentFrame* opener); |
| 40 ~ContentFrame(); |
| 41 |
| 42 int64 id() { return id_; } |
| 43 |
| 44 const WebKitFrameIdentifier active_webkit_frame() const { |
| 45 return active_webkit_frame_; |
| 46 } |
| 47 |
| 48 bool is_top_level() const { |
| 49 return is_top_level_; |
| 50 } |
| 51 |
| 52 TabContents& tab_contents() const { |
| 53 return tab_contents_; |
| 54 } |
| 55 |
| 56 // All WebKit frames that are either rendering this frame or are proxies for |
| 57 // this frame. |
| 58 const std::list<WebKitFrameIdentifier> all_webkit_frames() const { |
| 59 return all_webkit_frames_; |
| 60 } |
| 61 |
| 62 void UpdateFrame(int new_process_host_id, |
| 63 int new_route_id, |
| 64 int64 new_frame_id); |
| 65 |
| 66 ContentFrame* opener() const { |
| 67 return opener_; |
| 68 } |
| 69 |
| 70 // Child frames are subframes, and are removed when this ContentFrame |
| 71 // is navigated. |
| 72 const std::list<ContentFrame*> children() const { |
| 73 return children_; |
| 74 } |
| 75 |
| 76 void AddChildFrame(ContentFrame* child); |
| 77 |
| 78 // This does not actually delete the ContentFrames -- the caller must do this. |
| 79 void RemoveChildren(); |
| 80 |
| 81 private: |
| 82 int64 id_; |
| 83 WebKitFrameIdentifier active_webkit_frame_; |
| 84 bool is_top_level_; |
| 85 std::list<WebKitFrameIdentifier> all_webkit_frames_; |
| 86 TabContents& tab_contents_; |
| 87 ContentFrame* opener_; |
| 88 std::list<ContentFrame*> children_; |
| 89 }; |
| 90 |
| 91 } // namespace content |
| 92 |
| 93 #endif // CONTENT_BROWSER_CONTENT_FRAME_H_ |
OLD | NEW |