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

Unified 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: Updated the diff using -M1% -B1% to capture the refactoring better Created 9 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/tab_contents/tab_contents_container.h
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.h b/chrome/browser/ui/views/tab_contents/tab_contents_container.h
dissimilarity index 89%
index 9928f5b89cc909f94c2d54408add9519d96ff14d..da587991ee9c5a95f2d683cdb36be20dad133a73 100644
--- a/chrome/browser/ui/views/tab_contents/tab_contents_container.h
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.h
@@ -1,106 +1,25 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
-#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
-#pragma once
-
-#include "chrome/browser/views/tab_contents/native_tab_contents_container.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "views/view.h"
-
-class NativeTabContentsContainer;
-class RenderViewHost;
-class RenderWidgetHostView;
-class TabContents;
-
-class TabContentsContainer : public views::View,
- public NotificationObserver {
- public:
- // Interface to request the reserved contents area updates.
- class ReservedAreaDelegate {
- public:
- // Notifies that |source|'s reserved contents area should be updated.
- // Reserved contents area is a rect in tab contents view coordinates where
- // contents should not be rendered (to display the resize corner, sidebar
- // mini tabs or any other UI elements overlaying this container).
- virtual void UpdateReservedContentsRect(
- const TabContentsContainer* source) = 0;
- protected:
- virtual ~ReservedAreaDelegate() {}
- };
-
- TabContentsContainer();
- virtual ~TabContentsContainer();
-
- // Changes the TabContents associated with this view.
- void ChangeTabContents(TabContents* contents);
-
- View* GetFocusView() { return native_container_->GetView(); }
-
- // Accessor for |tab_contents_|.
- TabContents* tab_contents() const { return tab_contents_; }
-
- // Called by the BrowserView to notify that |tab_contents| got the focus.
- void TabContentsFocused(TabContents* tab_contents);
-
- // Tells the container to update less frequently during resizing operations
- // so performance is better.
- void SetFastResize(bool fast_resize);
-
- void set_reserved_area_delegate(ReservedAreaDelegate* delegate) {
- reserved_area_delegate_ = delegate;
- }
-
- // Overridden from NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Overridden from views::View:
- virtual void Layout();
- virtual AccessibilityTypes::Role GetAccessibleRole();
-
- protected:
- // Overridden from views::View:
- virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
- views::View* child);
-
- private:
- // Add or remove observers for events that we care about.
- void AddObservers();
- void RemoveObservers();
-
- // Called when the RenderViewHost of the hosted TabContents has changed, e.g.
- // to show an interstitial page.
- void RenderViewHostChanged(RenderViewHost* old_host,
- RenderViewHost* new_host);
-
- // Called when a TabContents is destroyed. This gives us a chance to clean
- // up our internal state if the TabContents is somehow destroyed before we
- // get notified.
- void TabContentsDestroyed(TabContents* contents);
-
- // Called when the RenderWidgetHostView of the hosted TabContents has changed.
- void RenderWidgetHostViewChanged(RenderWidgetHostView* old_view,
- RenderWidgetHostView* new_view);
-
- // An instance of a NativeTabContentsContainer object that holds the native
- // view handle associated with the attached TabContents.
- NativeTabContentsContainer* native_container_;
-
- // The attached TabContents.
- TabContents* tab_contents_;
-
- // Handles registering for our notifications.
- NotificationRegistrar registrar_;
-
- // Delegate for enquiring reserved contents area. Not owned by us.
- ReservedAreaDelegate* reserved_area_delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(TabContentsContainer);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
+#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
+#pragma once
+
+// There are two strategies implemented for embedding the actual tab contents
+// which are to use a views implementaiton all the way down, or to use a
+// NativeViewHost to encapsulate a native widget that then contains another
+// views heirarchy rooted at that widget. The TOUCH_UI is currently the only UI
+// that uses the pure views approach.
+//
+// Common code to the two approaches is in tab_contents_container.cc, while
+// views-only code is in tab_contents_container_views.cc and native-widget only
+// code is in tab_contents_container_native.cc. The headers are distinct
+// because the classes have different member variables.
+#if defined(TOUCH_UI)
+#include "chrome/browser/ui/views/tab_contents/tab_contents_container_views.h"
+#else
+#include "chrome/browser/ui/views/tab_contents/tab_contents_container_native.h"
+#endif
+
+#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_

Powered by Google App Engine
This is Rietveld 408576698