Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/ui/views/tab_contents/tab_contents_container.h

Issue 6247001: Re-land 71230.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 "chrome/common/notification_observer.h" 10 #include "chrome/common/notification_observer.h"
11 #include "chrome/common/notification_registrar.h" 11 #include "chrome/common/notification_registrar.h"
12 #include "views/view.h" 12 #include "views/view.h"
13 13
14 class NativeTabContentsContainer; 14 class NativeTabContentsContainer;
15 class RenderViewHost; 15 class RenderViewHost;
16 class RenderWidgetHostView; 16 class RenderWidgetHostView;
17 class TabContents; 17 class TabContents;
18 18
19 class TabContentsContainer : public views::View, 19 class TabContentsContainer : public views::View,
20 public NotificationObserver { 20 public NotificationObserver {
21 public: 21 public:
22 // Interface to request the reserved contents area updates.
23 class ReservedAreaDelegate {
24 public:
25 // Notifies that |source|'s reserved contents area should be updated.
26 // Reserved contents area is a rect in tab contents view coordinates where
27 // contents should not be rendered (to display the resize corner, sidebar
28 // mini tabs or any other UI elements overlaying this container).
29 virtual void UpdateReservedContentsRect(
30 const TabContentsContainer* source) = 0;
31 protected:
32 virtual ~ReservedAreaDelegate() {}
33 };
34
35 TabContentsContainer(); 22 TabContentsContainer();
36 virtual ~TabContentsContainer(); 23 virtual ~TabContentsContainer();
37 24
38 // Changes the TabContents associated with this view. 25 // Changes the TabContents associated with this view.
39 void ChangeTabContents(TabContents* contents); 26 void ChangeTabContents(TabContents* contents);
40 27
41 View* GetFocusView() { return native_container_->GetView(); } 28 View* GetFocusView() { return native_container_->GetView(); }
42 29
43 // Accessor for |tab_contents_|. 30 // Accessor for |tab_contents_|.
44 TabContents* tab_contents() const { return tab_contents_; } 31 TabContents* tab_contents() const { return tab_contents_; }
45 32
46 // Called by the BrowserView to notify that |tab_contents| got the focus. 33 // Called by the BrowserView to notify that |tab_contents| got the focus.
47 void TabContentsFocused(TabContents* tab_contents); 34 void TabContentsFocused(TabContents* tab_contents);
48 35
49 // Tells the container to update less frequently during resizing operations 36 // Tells the container to update less frequently during resizing operations
50 // so performance is better. 37 // so performance is better.
51 void SetFastResize(bool fast_resize); 38 void SetFastResize(bool fast_resize);
52 39
53 void set_reserved_area_delegate(ReservedAreaDelegate* delegate) { 40 // Updates the current reserved rect in view coordinates where contents
54 reserved_area_delegate_ = delegate; 41 // should not be rendered to draw the resize corner, sidebar mini tabs etc.
55 } 42 void SetReservedContentsRect(const gfx::Rect& reserved_rect);
56 43
57 // Overridden from NotificationObserver: 44 // Overridden from NotificationObserver:
58 virtual void Observe(NotificationType type, 45 virtual void Observe(NotificationType type,
59 const NotificationSource& source, 46 const NotificationSource& source,
60 const NotificationDetails& details); 47 const NotificationDetails& details);
61 48
62 // Overridden from views::View: 49 // Overridden from views::View:
63 virtual void Layout(); 50 virtual void Layout();
64 virtual AccessibilityTypes::Role GetAccessibleRole(); 51 virtual AccessibilityTypes::Role GetAccessibleRole();
65 52
(...skipping 11 matching lines...) Expand all
77 // to show an interstitial page. 64 // to show an interstitial page.
78 void RenderViewHostChanged(RenderViewHost* old_host, 65 void RenderViewHostChanged(RenderViewHost* old_host,
79 RenderViewHost* new_host); 66 RenderViewHost* new_host);
80 67
81 // Called when a TabContents is destroyed. This gives us a chance to clean 68 // 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 69 // up our internal state if the TabContents is somehow destroyed before we
83 // get notified. 70 // get notified.
84 void TabContentsDestroyed(TabContents* contents); 71 void TabContentsDestroyed(TabContents* contents);
85 72
86 // Called when the RenderWidgetHostView of the hosted TabContents has changed. 73 // Called when the RenderWidgetHostView of the hosted TabContents has changed.
87 void RenderWidgetHostViewChanged(RenderWidgetHostView* old_view, 74 void RenderWidgetHostViewChanged(RenderWidgetHostView* new_view);
88 RenderWidgetHostView* new_view);
89 75
90 // An instance of a NativeTabContentsContainer object that holds the native 76 // An instance of a NativeTabContentsContainer object that holds the native
91 // view handle associated with the attached TabContents. 77 // view handle associated with the attached TabContents.
92 NativeTabContentsContainer* native_container_; 78 NativeTabContentsContainer* native_container_;
93 79
94 // The attached TabContents. 80 // The attached TabContents.
95 TabContents* tab_contents_; 81 TabContents* tab_contents_;
96 82
97 // Handles registering for our notifications. 83 // Handles registering for our notifications.
98 NotificationRegistrar registrar_; 84 NotificationRegistrar registrar_;
99 85
100 // Delegate for enquiring reserved contents area. Not owned by us. 86 // The current reserved rect in view coordinates where contents should not be
101 ReservedAreaDelegate* reserved_area_delegate_; 87 // rendered to draw the resize corner, sidebar mini tabs etc.
88 // Cached here to update ever changing renderers.
89 gfx::Rect cached_reserved_rect_;
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_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.cc ('k') | chrome/browser/ui/views/tab_contents/tab_contents_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698