OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_VIEWS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/views/tab_contents/native_tab_contents_container.h" | |
10 #include "chrome/common/notification_observer.h" | 9 #include "chrome/common/notification_observer.h" |
11 #include "chrome/common/notification_registrar.h" | 10 #include "chrome/common/notification_registrar.h" |
12 #include "views/view.h" | 11 #include "views/view.h" |
13 | 12 |
14 class NativeTabContentsContainer; | 13 class NativeTabContentsContainer; |
15 class RenderViewHost; | 14 class RenderViewHost; |
16 class RenderWidgetHostView; | 15 class RenderWidgetHostView; |
17 class TabContents; | 16 class TabContents; |
18 | 17 |
19 class TabContentsContainer : public views::View, | 18 class TabContentsContainer : public views::View, |
(...skipping 11 matching lines...) Expand all Loading... |
31 protected: | 30 protected: |
32 virtual ~ReservedAreaDelegate() {} | 31 virtual ~ReservedAreaDelegate() {} |
33 }; | 32 }; |
34 | 33 |
35 TabContentsContainer(); | 34 TabContentsContainer(); |
36 virtual ~TabContentsContainer(); | 35 virtual ~TabContentsContainer(); |
37 | 36 |
38 // Changes the TabContents associated with this view. | 37 // Changes the TabContents associated with this view. |
39 void ChangeTabContents(TabContents* contents); | 38 void ChangeTabContents(TabContents* contents); |
40 | 39 |
41 View* GetFocusView() { return native_container_->GetView(); } | 40 View* GetFocusView() { return this; } |
42 | 41 |
43 // Accessor for |tab_contents_|. | 42 // Accessor for |tab_contents_|. |
44 TabContents* tab_contents() const { return tab_contents_; } | 43 TabContents* tab_contents() const { return tab_contents_; } |
45 | 44 |
46 // Called by the BrowserView to notify that |tab_contents| got the focus. | 45 // Called by the BrowserView to notify that |tab_contents| got the focus. |
47 void TabContentsFocused(TabContents* tab_contents); | 46 void TabContentsFocused(TabContents* tab_contents); |
48 | 47 |
49 // Tells the container to update less frequently during resizing operations | 48 // Tells the container to update less frequently during resizing operations |
50 // so performance is better. | 49 // so performance is better. |
51 void SetFastResize(bool fast_resize); | 50 void SetFastResize(bool fast_resize); |
52 | 51 |
53 void set_reserved_area_delegate(ReservedAreaDelegate* delegate) { | 52 void set_reserved_area_delegate(ReservedAreaDelegate* delegate) { |
54 reserved_area_delegate_ = delegate; | 53 reserved_area_delegate_ = delegate; |
55 } | 54 } |
56 | 55 |
57 // Overridden from NotificationObserver: | 56 // Overridden from NotificationObserver: |
58 virtual void Observe(NotificationType type, | 57 virtual void Observe(NotificationType type, |
59 const NotificationSource& source, | 58 const NotificationSource& source, |
60 const NotificationDetails& details); | 59 const NotificationDetails& details); |
61 | 60 |
62 // Overridden from views::View: | |
63 virtual void Layout(); | |
64 virtual AccessibilityTypes::Role GetAccessibleRole(); | 61 virtual AccessibilityTypes::Role GetAccessibleRole(); |
65 | 62 |
66 protected: | |
67 // Overridden from views::View: | |
68 virtual void ViewHierarchyChanged(bool is_add, views::View* parent, | |
69 views::View* child); | |
70 | |
71 private: | 63 private: |
72 // Add or remove observers for events that we care about. | 64 // Add or remove observers for events that we care about. |
73 void AddObservers(); | 65 void AddObservers(); |
74 void RemoveObservers(); | 66 void RemoveObservers(); |
75 | 67 |
76 // Called when the RenderViewHost of the hosted TabContents has changed, e.g. | 68 // Called when the RenderViewHost of the hosted TabContents has changed, e.g. |
77 // to show an interstitial page. | 69 // to show an interstitial page. |
78 void RenderViewHostChanged(RenderViewHost* old_host, | 70 void RenderViewHostChanged(RenderViewHost* old_host, |
79 RenderViewHost* new_host); | 71 RenderViewHost* new_host); |
80 | 72 |
81 // Called when a TabContents is destroyed. This gives us a chance to clean | 73 // Called when a TabContents is destroyed. This gives us a chance to clean |
82 // up our internal state if the TabContents is somehow destroyed before we | 74 // up our internal state if the TabContents is somehow destroyed before we |
83 // get notified. | 75 // get notified. |
84 void TabContentsDestroyed(TabContents* contents); | 76 void TabContentsDestroyed(TabContents* contents); |
85 | 77 |
86 // Called when the RenderWidgetHostView of the hosted TabContents has changed. | 78 // Called when the RenderWidgetHostView of the hosted TabContents has changed. |
87 void RenderWidgetHostViewChanged(RenderWidgetHostView* old_view, | 79 void RenderWidgetHostViewChanged(RenderWidgetHostView* old_view, |
88 RenderWidgetHostView* new_view); | 80 RenderWidgetHostView* new_view); |
89 | 81 |
90 // An instance of a NativeTabContentsContainer object that holds the native | |
91 // view handle associated with the attached TabContents. | |
92 NativeTabContentsContainer* native_container_; | |
93 | |
94 // The attached TabContents. | 82 // The attached TabContents. |
95 TabContents* tab_contents_; | 83 TabContents* tab_contents_; |
96 | 84 |
97 // Handles registering for our notifications. | 85 // Handles registering for our notifications. |
98 NotificationRegistrar registrar_; | 86 NotificationRegistrar registrar_; |
99 | 87 |
100 // Delegate for enquiring reserved contents area. Not owned by us. | 88 // Delegate for enquiring reserved contents area. Not owned by us. |
101 ReservedAreaDelegate* reserved_area_delegate_; | 89 ReservedAreaDelegate* reserved_area_delegate_; |
102 | 90 |
103 DISALLOW_COPY_AND_ASSIGN(TabContentsContainer); | 91 DISALLOW_COPY_AND_ASSIGN(TabContentsContainer); |
104 }; | 92 }; |
105 | 93 |
106 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ | 94 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_VIEWS_H_ |
OLD | NEW |