| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windowsx.h> | 8 #include <windowsx.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 302 |
| 303 // Set the background offset used to match the background image to the frame | 303 // Set the background offset used to match the background image to the frame |
| 304 // image. | 304 // image. |
| 305 void set_background_offset(const gfx::Point& offset) { | 305 void set_background_offset(const gfx::Point& offset) { |
| 306 background_offset_ = offset; | 306 background_offset_ = offset; |
| 307 } | 307 } |
| 308 | 308 |
| 309 protected: | 309 protected: |
| 310 // Overridden from views::View: | 310 // Overridden from views::View: |
| 311 virtual bool HasHitTestMask() const OVERRIDE; | 311 virtual bool HasHitTestMask() const OVERRIDE; |
| 312 virtual void GetHitTestMask(gfx::Path* path) const OVERRIDE; | 312 virtual void GetHitTestMask(HitTestSource source, |
| 313 gfx::Path* path) const OVERRIDE; |
| 313 #if defined(OS_WIN) | 314 #if defined(OS_WIN) |
| 314 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 315 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 315 #endif | 316 #endif |
| 316 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 317 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 317 | 318 |
| 318 // Overridden from ui::EventHandler: | 319 // Overridden from ui::EventHandler: |
| 319 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 320 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 320 | 321 |
| 321 private: | 322 private: |
| 322 bool ShouldUseNativeFrame() const; | 323 bool ShouldUseNativeFrame() const; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 349 *destroyed_ = true; | 350 *destroyed_ = true; |
| 350 } | 351 } |
| 351 | 352 |
| 352 bool NewTabButton::HasHitTestMask() const { | 353 bool NewTabButton::HasHitTestMask() const { |
| 353 // When the button is sized to the top of the tab strip we want the user to | 354 // When the button is sized to the top of the tab strip we want the user to |
| 354 // be able to click on complete bounds, and so don't return a custom hit | 355 // be able to click on complete bounds, and so don't return a custom hit |
| 355 // mask. | 356 // mask. |
| 356 return !tab_strip_->SizeTabButtonToTopOfTabStrip(); | 357 return !tab_strip_->SizeTabButtonToTopOfTabStrip(); |
| 357 } | 358 } |
| 358 | 359 |
| 359 void NewTabButton::GetHitTestMask(gfx::Path* path) const { | 360 void NewTabButton::GetHitTestMask(HitTestSource source, gfx::Path* path) const { |
| 360 DCHECK(path); | 361 DCHECK(path); |
| 361 | 362 |
| 362 SkScalar w = SkIntToScalar(width()); | 363 SkScalar w = SkIntToScalar(width()); |
| 363 SkScalar v_offset = SkIntToScalar(newtab_button_v_offset()); | 364 SkScalar v_offset = SkIntToScalar(newtab_button_v_offset()); |
| 364 | 365 |
| 365 // These values are defined by the shape of the new tab image. Should that | 366 // These values are defined by the shape of the new tab image. Should that |
| 366 // image ever change, these values will need to be updated. They're so | 367 // image ever change, these values will need to be updated. They're so |
| 367 // custom it's not really worth defining constants for. | 368 // custom it's not really worth defining constants for. |
| 368 // These values are correct for regular and USE_ASH versions of the image. | 369 // These values are correct for regular and USE_ASH versions of the image. |
| 369 path->moveTo(0, v_offset + 1); | 370 path->moveTo(0, v_offset + 1); |
| (...skipping 2344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2714 if (!adjust_layout_) | 2715 if (!adjust_layout_) |
| 2715 return false; | 2716 return false; |
| 2716 | 2717 |
| 2717 #if !defined(OS_CHROMEOS) | 2718 #if !defined(OS_CHROMEOS) |
| 2718 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 2719 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
| 2719 return false; | 2720 return false; |
| 2720 #endif | 2721 #endif |
| 2721 | 2722 |
| 2722 return true; | 2723 return true; |
| 2723 } | 2724 } |
| OLD | NEW |