| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" | 9 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" |
| 10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 | 13 |
| 14 class NativeTabContentsContainer; | 14 class NativeTabContentsContainer; |
| 15 class RenderViewHost; | 15 class RenderViewHost; |
| 16 class RenderWidgetHostView; | |
| 17 | 16 |
| 18 namespace content { | 17 namespace content { |
| 19 class WebContents; | 18 class WebContents; |
| 20 } | 19 } |
| 21 | 20 |
| 22 class TabContentsContainer : public views::View, | 21 class TabContentsContainer : public views::View, |
| 23 public content::NotificationObserver { | 22 public content::NotificationObserver { |
| 24 public: | 23 public: |
| 25 TabContentsContainer(); | 24 TabContentsContainer(); |
| 26 virtual ~TabContentsContainer(); | 25 virtual ~TabContentsContainer(); |
| 27 | 26 |
| 28 // Changes the WebContents associated with this view. | 27 // Changes the WebContents associated with this view. |
| 29 void ChangeWebContents(content::WebContents* contents); | 28 void ChangeWebContents(content::WebContents* contents); |
| 30 | 29 |
| 31 View* GetFocusView() { return native_container_->GetView(); } | 30 View* GetFocusView() { return native_container_->GetView(); } |
| 32 | 31 |
| 33 // TODO(jam): move web_contents() to header. | 32 // TODO(jam): move web_contents() to header. |
| 34 content::WebContents* web_contents(); | 33 content::WebContents* web_contents(); |
| 35 | 34 |
| 36 // Called by the BrowserView to notify that |contents| got the focus. | 35 // Called by the BrowserView to notify that |contents| got the focus. |
| 37 void WebContentsFocused(content::WebContents* contents); | 36 void WebContentsFocused(content::WebContents* contents); |
| 38 | 37 |
| 39 // Tells the container to update less frequently during resizing operations | 38 // Tells the container to update less frequently during resizing operations |
| 40 // so performance is better. | 39 // so performance is better. |
| 41 void SetFastResize(bool fast_resize); | 40 void SetFastResize(bool fast_resize); |
| 42 | 41 |
| 43 // Updates the current reserved rect in view coordinates where contents | |
| 44 // should not be rendered to draw the resize corner, etc. | |
| 45 void SetReservedContentsRect(const gfx::Rect& reserved_rect); | |
| 46 | |
| 47 // Overridden from content::NotificationObserver: | 42 // Overridden from content::NotificationObserver: |
| 48 virtual void Observe(int type, | 43 virtual void Observe(int type, |
| 49 const content::NotificationSource& source, | 44 const content::NotificationSource& source, |
| 50 const content::NotificationDetails& details) OVERRIDE; | 45 const content::NotificationDetails& details) OVERRIDE; |
| 51 | 46 |
| 52 // Overridden from views::View: | 47 // Overridden from views::View: |
| 53 virtual void Layout() OVERRIDE; | 48 virtual void Layout() OVERRIDE; |
| 54 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 49 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 55 #if defined(HAVE_XINPUT2) | 50 #if defined(HAVE_XINPUT2) |
| 56 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 51 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 69 // Called when the RenderViewHost of the hosted TabContents has changed, e.g. | 64 // Called when the RenderViewHost of the hosted TabContents has changed, e.g. |
| 70 // to show an interstitial page. | 65 // to show an interstitial page. |
| 71 void RenderViewHostChanged(RenderViewHost* old_host, | 66 void RenderViewHostChanged(RenderViewHost* old_host, |
| 72 RenderViewHost* new_host); | 67 RenderViewHost* new_host); |
| 73 | 68 |
| 74 // Called when a WebContents is destroyed. This gives us a chance to clean | 69 // Called when a WebContents is destroyed. This gives us a chance to clean |
| 75 // up our internal state if the TabContents is somehow destroyed before we | 70 // up our internal state if the TabContents is somehow destroyed before we |
| 76 // get notified. | 71 // get notified. |
| 77 void TabContentsDestroyed(content::WebContents* contents); | 72 void TabContentsDestroyed(content::WebContents* contents); |
| 78 | 73 |
| 79 // Called when the RenderWidgetHostView of the hosted TabContents has changed. | |
| 80 void RenderWidgetHostViewChanged(RenderWidgetHostView* new_view); | |
| 81 | |
| 82 // An instance of a NativeTabContentsContainer object that holds the native | 74 // An instance of a NativeTabContentsContainer object that holds the native |
| 83 // view handle associated with the attached TabContents. | 75 // view handle associated with the attached TabContents. |
| 84 NativeTabContentsContainer* native_container_; | 76 NativeTabContentsContainer* native_container_; |
| 85 | 77 |
| 86 // The attached WebContents. | 78 // The attached WebContents. |
| 87 content::WebContents* web_contents_; | 79 content::WebContents* web_contents_; |
| 88 | 80 |
| 89 // Handles registering for our notifications. | 81 // Handles registering for our notifications. |
| 90 content::NotificationRegistrar registrar_; | 82 content::NotificationRegistrar registrar_; |
| 91 | 83 |
| 92 // The current reserved rect in view coordinates where contents should not be | 84 // The current reserved rect in view coordinates where contents should not be |
| 93 // rendered to draw the resize corner, etc. | 85 // rendered to draw the resize corner, etc. |
| 94 // Cached here to update ever changing renderers. | 86 // Cached here to update ever changing renderers. |
| 95 gfx::Rect cached_reserved_rect_; | 87 gfx::Rect cached_reserved_rect_; |
| 96 | 88 |
| 97 DISALLOW_COPY_AND_ASSIGN(TabContentsContainer); | 89 DISALLOW_COPY_AND_ASSIGN(TabContentsContainer); |
| 98 }; | 90 }; |
| 99 | 91 |
| 100 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ | 92 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ |
| OLD | NEW |