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

Unified Diff: chrome/browser/views/tabs/tab.cc

Issue 341008: CompactLocationBar (Closed)
Patch Set: comment updated Created 11 years, 2 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
« no previous file with comments | « chrome/browser/views/tabs/tab.h ('k') | chrome/browser/views/tabs/tab_strip.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/tabs/tab.cc
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index f69ced8727e1f909171aacb77d98dd7ac4f7e486..7876ae26ae49c079bf5375f9a2b8c2fdb05b0c5e 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -11,6 +11,9 @@
#include "app/resource_bundle.h"
#include "base/compiler_specific.h"
#include "base/gfx/size.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"
#include "views/controls/menu/simple_menu_model.h"
#include "views/widget/tooltip_manager.h"
@@ -155,8 +158,14 @@ bool Tab::OnMousePressed(const views::MouseEvent& event) {
// able to drag foreground tabs, so we don't start dragging the tab if
// it was in the background.
bool just_selected = !IsSelected();
- if (just_selected)
+ 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);
}
return true;
@@ -183,6 +192,18 @@ void Tab::OnMouseReleased(const views::MouseEvent& event, bool canceled) {
delegate_->CloseTab(this);
}
+void Tab::OnMouseEntered(const views::MouseEvent& event) {
+ GetBrowserExtender()->OnMouseEnteredToTab(this);
+}
+
+void Tab::OnMouseMoved(const views::MouseEvent& event) {
+ GetBrowserExtender()->OnMouseMovedOnTab(this);
+}
+
+void Tab::OnMouseExited(const views::MouseEvent& event) {
+ GetBrowserExtender()->OnMouseExitedFromTab(this);
+}
+
bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) {
std::wstring title = GetTitle();
if (!title.empty()) {
@@ -236,6 +257,17 @@ 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);
« no previous file with comments | « chrome/browser/views/tabs/tab.h ('k') | chrome/browser/views/tabs/tab_strip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698