| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/views/tabs/tab.h" | 5 #include "chrome/browser/views/tabs/tab.h" |
| 6 | 6 |
| 7 #include "base/gfx/size.h" | 7 #include "base/gfx/size.h" |
| 8 #include "chrome/common/gfx/chrome_canvas.h" | 8 #include "chrome/common/gfx/chrome_canvas.h" |
| 9 #include "chrome/common/gfx/path.h" | 9 #include "chrome/common/gfx/path.h" |
| 10 #include "chrome/common/l10n_util.h" | 10 #include "chrome/common/l10n_util.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 bool Tab::HasHitTestMask() const { | 152 bool Tab::HasHitTestMask() const { |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void Tab::GetHitTestMask(gfx::Path* mask) const { | 156 void Tab::GetHitTestMask(gfx::Path* mask) const { |
| 157 MakePathForTab(mask); | 157 MakePathForTab(mask); |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool Tab::OnMousePressed(const views::MouseEvent& event) { | 160 bool Tab::OnMousePressed(const views::MouseEvent& event) { |
| 161 if (event.IsLeftMouseButton()) { | 161 if (event.IsLeftMouseButton()) { |
| 162 // When only one tab is present, instead of ripping it out on drag, | |
| 163 // it dragged the whole window. This is done by sending a non-client | |
| 164 // message which is handled by the default window procedure and causes | |
| 165 // the window get the default drag-on-caption behavior. | |
| 166 if (!delegate_->HasAvailableDragActions()) { | |
| 167 SendMessage(GetWidget()->GetHWND(), WM_NCLBUTTONDOWN, | |
| 168 HTCAPTION, MAKELPARAM(event.x(), event.y())); | |
| 169 return false; | |
| 170 } | |
| 171 // Store whether or not we were selected just now... we only want to be | 162 // Store whether or not we were selected just now... we only want to be |
| 172 // able to drag foreground tabs, so we don't start dragging the tab if | 163 // able to drag foreground tabs, so we don't start dragging the tab if |
| 173 // it was in the background. | 164 // it was in the background. |
| 174 bool just_selected = !IsSelected(); | 165 bool just_selected = !IsSelected(); |
| 175 if (just_selected) | 166 if (just_selected) |
| 176 delegate_->SelectTab(this); | 167 delegate_->SelectTab(this); |
| 177 delegate_->MaybeStartDrag(this, event); | 168 delegate_->MaybeStartDrag(this, event); |
| 178 } | 169 } |
| 179 return true; | 170 return true; |
| 180 } | 171 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 270 |
| 280 // Close out the path. | 271 // Close out the path. |
| 281 path->lineTo(0, h); | 272 path->lineTo(0, h); |
| 282 path->close(); | 273 path->close(); |
| 283 } | 274 } |
| 284 | 275 |
| 285 void Tab::ContextMenuClosed() { | 276 void Tab::ContextMenuClosed() { |
| 286 delegate()->StopAllHighlighting(); | 277 delegate()->StopAllHighlighting(); |
| 287 menu_controller_ = NULL; | 278 menu_controller_ = NULL; |
| 288 } | 279 } |
| OLD | NEW |