| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ |
| 6 #define CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ | 6 #define CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ |
| 7 | 7 |
| 8 #ifdef UNIT_TEST | |
| 9 #include "chrome/browser/views/tab_contents/native_tab_contents_container.h" | 8 #include "chrome/browser/views/tab_contents/native_tab_contents_container.h" |
| 10 #endif | |
| 11 #include "chrome/common/notification_registrar.h" | 9 #include "chrome/common/notification_registrar.h" |
| 12 #include "views/view.h" | 10 #include "views/view.h" |
| 13 | 11 |
| 14 class NativeTabContentsContainer; | 12 class NativeTabContentsContainer; |
| 15 class RenderViewHost; | 13 class RenderViewHost; |
| 16 class TabContents; | 14 class TabContents; |
| 17 | 15 |
| 18 class TabContentsContainer : public views::View, | 16 class TabContentsContainer : public views::View, |
| 19 public NotificationObserver { | 17 public NotificationObserver { |
| 20 public: | 18 public: |
| 21 TabContentsContainer(); | 19 TabContentsContainer(); |
| 22 virtual ~TabContentsContainer(); | 20 virtual ~TabContentsContainer(); |
| 23 | 21 |
| 24 // Changes the TabContents associated with this view. | 22 // Changes the TabContents associated with this view. |
| 25 void ChangeTabContents(TabContents* contents); | 23 void ChangeTabContents(TabContents* contents); |
| 26 | 24 |
| 25 View* GetFocusView() { return native_container_->GetView(); } |
| 26 |
| 27 // Accessor for |tab_contents_|. | 27 // Accessor for |tab_contents_|. |
| 28 TabContents* tab_contents() const { return tab_contents_; } | 28 TabContents* tab_contents() const { return tab_contents_; } |
| 29 | 29 |
| 30 #ifdef UNIT_TEST | 30 // Called by the BrowserView to notify that |tab_contents| got the focus. |
| 31 View* GetFocusView() { return native_container_->GetView(); } | 31 void TabContentsFocused(TabContents* tab_contents); |
| 32 #endif | |
| 33 | 32 |
| 34 // Tells the container to update less frequently during resizing operations | 33 // Tells the container to update less frequently during resizing operations |
| 35 // so performance is better. | 34 // so performance is better. |
| 36 void SetFastResize(bool fast_resize); | 35 void SetFastResize(bool fast_resize); |
| 37 | 36 |
| 38 // Overridden from NotificationObserver: | 37 // Overridden from NotificationObserver: |
| 39 virtual void Observe(NotificationType type, | 38 virtual void Observe(NotificationType type, |
| 40 const NotificationSource& source, | 39 const NotificationSource& source, |
| 41 const NotificationDetails& details); | 40 const NotificationDetails& details); |
| 42 | 41 |
| 43 // Overridden from views::View: | 42 // Overridden from views::View: |
| 44 virtual void Layout(); | 43 virtual void Layout(); |
| 44 |
| 45 protected: | 45 protected: |
| 46 | |
| 47 // Overridden from views::View: | 46 // Overridden from views::View: |
| 48 virtual void ViewHierarchyChanged(bool is_add, views::View* parent, | 47 virtual void ViewHierarchyChanged(bool is_add, views::View* parent, |
| 49 views::View* child); | 48 views::View* child); |
| 50 | 49 |
| 51 private: | 50 private: |
| 52 // Add or remove observers for events that we care about. | 51 // Add or remove observers for events that we care about. |
| 53 void AddObservers(); | 52 void AddObservers(); |
| 54 void RemoveObservers(); | 53 void RemoveObservers(); |
| 55 | 54 |
| 56 // Called when the RenderViewHost of the hosted TabContents has changed, e.g. | 55 // Called when the RenderViewHost of the hosted TabContents has changed, e.g. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 70 // The attached TabContents. | 69 // The attached TabContents. |
| 71 TabContents* tab_contents_; | 70 TabContents* tab_contents_; |
| 72 | 71 |
| 73 // Handles registering for our notifications. | 72 // Handles registering for our notifications. |
| 74 NotificationRegistrar registrar_; | 73 NotificationRegistrar registrar_; |
| 75 | 74 |
| 76 DISALLOW_COPY_AND_ASSIGN(TabContentsContainer); | 75 DISALLOW_COPY_AND_ASSIGN(TabContentsContainer); |
| 77 }; | 76 }; |
| 78 | 77 |
| 79 #endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ | 78 #endif // CHROME_BROWSER_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ |
| OLD | NEW |