| Index: chrome/browser/ui/views/tab_contents/tab_contents_container_views.cc
|
| diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.h b/chrome/browser/ui/views/tab_contents/tab_contents_container_views.cc
|
| similarity index 4%
|
| copy from chrome/browser/ui/views/tab_contents/tab_contents_container.h
|
| copy to chrome/browser/ui/views/tab_contents/tab_contents_container_views.cc
|
| index 9928f5b89cc909f94c2d54408add9519d96ff14d..6964d657ea1ef490772677477cfe6c34a9ba5bc9 100644
|
| --- a/chrome/browser/ui/views/tab_contents/tab_contents_container.h
|
| +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container_views.cc
|
| @@ -2,105 +2,59 @@
|
| // 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;
|
| +#include "chrome/browser/views/tab_contents/tab_contents_container.h"
|
| +
|
| +#include "chrome/browser/renderer_host/render_view_host.h"
|
| +#include "chrome/browser/renderer_host/render_widget_host_view.h"
|
| +#include "chrome/browser/tab_contents/interstitial_page.h"
|
| +#include "chrome/browser/tab_contents/tab_contents.h"
|
| +#include "chrome/browser/ui/view_ids.h"
|
| +#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h"
|
| +#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h"
|
| +#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
|
| +#include "chrome/common/notification_details.h"
|
| +#include "chrome/common/notification_source.h"
|
| +#include "views/fill_layout.h"
|
| +
|
| +// Some of this class is implemented in tab_contents_container.cc, where
|
| +// the implementation doesn't vary between a pure views approach and a
|
| +// native view host approach. See the header file for details.
|
| +
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// TabContentsContainer, public:
|
| +
|
| +TabContentsContainer::TabContentsContainer()
|
| + : tab_contents_(NULL),
|
| + reserved_area_delegate_(NULL) {
|
| + SetID(VIEW_ID_TAB_CONTAINER);
|
| +}
|
| +
|
| +void TabContentsContainer::ChangeTabContents(TabContents* contents) {
|
| + if (tab_contents_) {
|
| + views::View *v = static_cast<TabContentsViewViews*>(tab_contents_->view());
|
| + RemoveChildView(v);
|
| + tab_contents_->WasHidden();
|
| + RemoveObservers();
|
| }
|
| + tab_contents_ = contents;
|
| + // When detaching the last tab of the browser ChangeTabContents is invoked
|
| + // with NULL. Don't attempt to do anything in that case.
|
| + if (tab_contents_) {
|
| + views::View *v = static_cast<TabContentsViewViews*>(contents->view());
|
| + AddChildView(v);
|
| + SetLayoutManager(new views::FillLayout());
|
| + Layout();
|
| + AddObservers();
|
| + }
|
| +}
|
|
|
| - // 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_;
|
| +void TabContentsContainer::TabContentsFocused(TabContents* tab_contents) {
|
| +}
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(TabContentsContainer);
|
| -};
|
| +void TabContentsContainer::SetFastResize(bool fast_resize) {
|
| +}
|
|
|
| -#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_CONTAINER_H_
|
| +void TabContentsContainer::RenderViewHostChanged(RenderViewHost* old_host,
|
| + RenderViewHost* new_host) {
|
| + NOTIMPLEMENTED(); // TODO(anicolao)
|
| +}
|
|
|