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

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

Issue 6024007: First cut at creating a refactored version of tab_contents_views. This is (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with current head 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/tab_contents/tab_contents_container.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // There are two strategies implemented for embedding the actual tab contents
10 #include "chrome/common/notification_observer.h" 10 // which are to use a views implementaiton all the way down, or to use a
11 #include "chrome/common/notification_registrar.h" 11 // NativeViewHost to encapsulate a native widget that then contains another
12 #include "views/view.h" 12 // views heirarchy rooted at that widget. The TOUCH_UI is currently the only UI
13 13 // that uses the pure views approach.
14 class NativeTabContentsContainer; 14 //
15 class RenderViewHost; 15 // Common code to the two approaches is in tab_contents_container.cc, while
16 class RenderWidgetHostView; 16 // views-only code is in tab_contents_container_views.cc and native-widget only
17 class TabContents; 17 // code is in tab_contents_container_native.cc. The headers are distinct
18 18 // because the classes have different member variables.
19 class TabContentsContainer : public views::View, 19 #if defined(TOUCH_UI)
20 public NotificationObserver { 20 #include "chrome/browser/ui/views/tab_contents/tab_contents_container_views.h"
21 public: 21 #else
22 TabContentsContainer(); 22 #include "chrome/browser/ui/views/tab_contents/tab_contents_container_native.h"
23 virtual ~TabContentsContainer(); 23 #endif
24
25 // Changes the TabContents associated with this view.
26 void ChangeTabContents(TabContents* contents);
27
28 View* GetFocusView() { return native_container_->GetView(); }
29
30 // Accessor for |tab_contents_|.
31 TabContents* tab_contents() const { return tab_contents_; }
32
33 // Called by the BrowserView to notify that |tab_contents| got the focus.
34 void TabContentsFocused(TabContents* tab_contents);
35
36 // Tells the container to update less frequently during resizing operations
37 // so performance is better.
38 void SetFastResize(bool fast_resize);
39
40 // Updates the current reserved rect in view coordinates where contents
41 // should not be rendered to draw the resize corner, sidebar mini tabs etc.
42 void SetReservedContentsRect(const gfx::Rect& reserved_rect);
43
44 // Overridden from NotificationObserver:
45 virtual void Observe(NotificationType type,
46 const NotificationSource& source,
47 const NotificationDetails& details);
48
49 // Overridden from views::View:
50 virtual void Layout();
51 virtual AccessibilityTypes::Role GetAccessibleRole();
52
53 protected:
54 // Overridden from views::View:
55 virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
56 views::View* child);
57
58 private:
59 // Add or remove observers for events that we care about.
60 void AddObservers();
61 void RemoveObservers();
62
63 // Called when the RenderViewHost of the hosted TabContents has changed, e.g.
64 // to show an interstitial page.
65 void RenderViewHostChanged(RenderViewHost* old_host,
66 RenderViewHost* new_host);
67
68 // Called when a TabContents is destroyed. This gives us a chance to clean
69 // up our internal state if the TabContents is somehow destroyed before we
70 // get notified.
71 void TabContentsDestroyed(TabContents* contents);
72
73 // Called when the RenderWidgetHostView of the hosted TabContents has changed.
74 void RenderWidgetHostViewChanged(RenderWidgetHostView* new_view);
75
76 // An instance of a NativeTabContentsContainer object that holds the native
77 // view handle associated with the attached TabContents.
78 NativeTabContentsContainer* native_container_;
79
80 // The attached TabContents.
81 TabContents* tab_contents_;
82
83 // Handles registering for our notifications.
84 NotificationRegistrar registrar_;
85
86 // The current reserved rect in view coordinates where contents should not be
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_;
90
91 DISALLOW_COPY_AND_ASSIGN(TabContentsContainer);
92 };
93 24
94 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_ 25 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
OLDNEW
« no previous file with comments | « no previous file | 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