summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/tabs
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views/tabs')
-rw-r--r--chrome/browser/views/tabs/tab.cc31
-rw-r--r--chrome/browser/views/tabs/tab.h7
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc6
-rw-r--r--chrome/browser/views/tabs/tab_strip.h6
4 files changed, 10 insertions, 40 deletions
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index a775734..efebda1 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -13,7 +13,6 @@
#include "base/compiler_specific.h"
#include "base/gfx/size.h"
#include "chrome/browser/tab_menu_model.h"
-#include "chrome/browser/views/frame/browser_extender.h"
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/tabs/tab_strip.h"
#include "grit/generated_resources.h"
@@ -142,11 +141,6 @@ bool Tab::OnMousePressed(const views::MouseEvent& event) {
bool just_selected = !IsSelected();
if (just_selected) {
delegate_->SelectTab(this);
- // This is a hack to update the compact location bar when the tab
- // is selected. This is just an experiement and will be modified later.
- // TODO(oshima): Improve the BrowserExtender interface if we
- // decided to keep this UI, or remove this otherwise.
- GetBrowserExtender()->OnMouseEnteredToTab(this);
}
delegate_->MaybeStartDrag(this, event);
}
@@ -174,20 +168,6 @@ void Tab::OnMouseReleased(const views::MouseEvent& event, bool canceled) {
delegate_->CloseTab(this);
}
-void Tab::OnMouseEntered(const views::MouseEvent& event) {
- TabRenderer::OnMouseEntered(event);
- GetBrowserExtender()->OnMouseEnteredToTab(this);
-}
-
-void Tab::OnMouseMoved(const views::MouseEvent& event) {
- GetBrowserExtender()->OnMouseMovedOnTab(this);
-}
-
-void Tab::OnMouseExited(const views::MouseEvent& event) {
- TabRenderer::OnMouseExited(event);
- GetBrowserExtender()->OnMouseExitedFromTab(this);
-}
-
bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) {
std::wstring title = GetTitle();
if (!title.empty()) {
@@ -241,17 +221,6 @@ void Tab::ButtonPressed(views::Button* sender, const views::Event& event) {
///////////////////////////////////////////////////////////////////////////////
// Tab, private:
-BrowserExtender* Tab::GetBrowserExtender() {
- // This is a hack to BrowserExtender from a Tab.
- // TODO(oshima): Fix when the decision on compact location bar is made.
- // Potential candidates are:
- // * Use View ID with a cached reference to BrowserView.
- // * Pass the BrowserView reference to Tabs.
- // * Add GetBrowserView method to Delegate.
- TabStrip* tab_strip = static_cast<TabStrip*>(delegate_);
- return static_cast<BrowserView*>(tab_strip->GetParent())->browser_extender();
-}
-
void Tab::MakePathForTab(gfx::Path* path) const {
DCHECK(path);
diff --git a/chrome/browser/views/tabs/tab.h b/chrome/browser/views/tabs/tab.h
index e543ea3..303a80a 100644
--- a/chrome/browser/views/tabs/tab.h
+++ b/chrome/browser/views/tabs/tab.h
@@ -12,7 +12,6 @@ namespace gfx {
class Path;
class Point;
}
-class BrowserExtender;
///////////////////////////////////////////////////////////////////////////////
//
@@ -95,9 +94,6 @@ class Tab : public TabRenderer,
virtual bool OnMouseDragged(const views::MouseEvent& event);
virtual void OnMouseReleased(const views::MouseEvent& event,
bool canceled);
- virtual void OnMouseEntered(const views::MouseEvent& event);
- virtual void OnMouseMoved(const views::MouseEvent& event);
- virtual void OnMouseExited(const views::MouseEvent& event);
virtual bool GetTooltipText(int x, int y, std::wstring* tooltip);
virtual bool GetTooltipTextOrigin(int x, int y, gfx::Point* origin);
virtual std::string GetClassName() const { return kTabClassName; }
@@ -113,9 +109,6 @@ class Tab : public TabRenderer,
// views::ButtonListener overrides:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // Returns the BrowserExtender of the window that this tab belongs to.
- BrowserExtender* GetBrowserExtender();
-
// Creates a path that contains the clickable region of the tab's visual
// representation. Used by GetViewForPoint for hit-testing.
void MakePathForTab(gfx::Path* path) const;
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index 248506a..27bbb68 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -1052,6 +1052,10 @@ void TabStrip::ThemeChanged() {
LoadNewTabButtonImage();
}
+Tab* TabStrip::CreateTab() {
+ return new Tab(this);
+}
+
void TabStrip::ViewHierarchyChanged(bool is_add,
views::View* parent,
views::View* child) {
@@ -1101,7 +1105,7 @@ void TabStrip::TabInsertedAt(TabContents* contents,
// Otherwise we need to make a new Tab.
if (!tab)
- tab = new Tab(this);
+ tab = CreateTab();
// Only insert if we're not already in the list.
if (!contains_tab) {
diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h
index 9ecece6..27f6a97 100644
--- a/chrome/browser/views/tabs/tab_strip.h
+++ b/chrome/browser/views/tabs/tab_strip.h
@@ -12,7 +12,6 @@
#include "views/controls/button/image_button.h"
#include "views/view.h"
-class BrowserExtender;
class DraggedTabController;
class ScopedMouseCloseWidthCalculator;
class TabStripModel;
@@ -117,7 +116,12 @@ class TabStrip : public views::View,
virtual void SetAccessibleName(const std::wstring& name);
virtual views::View* GetViewForPoint(const gfx::Point& point);
virtual void ThemeChanged();
+
protected:
+ // Creates a new tab.
+ virtual Tab* CreateTab();
+
+ // views::View implementation:
virtual void ViewHierarchyChanged(bool is_add,
views::View* parent,
views::View* child);