| 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 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_TAB_SCRUBBER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_TAB_SCRUBBER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_ASH_TAB_SCRUBBER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_ASH_TAB_SCRUBBER_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/notification_observer.h" | 8 #include "content/public/browser/notification_observer.h" |
| 9 #include "content/public/browser/notification_registrar.h" | 9 #include "content/public/browser/notification_registrar.h" |
| 10 #include "ui/base/events/event_handler.h" | 10 #include "ui/base/events/event_handler.h" |
| 11 | 11 |
| 12 class Browser; | 12 class Browser; |
| 13 class Tab; | 13 class Tab; |
| 14 | 14 |
| 15 // Class to enable quick tab switching via Ctrl-left-drag. | 15 // Class to enable quick tab switching via Ctrl-left-drag. |
| 16 // Notes: this is experimental, and disables ctrl-clicks. It should not be | 16 // Notes: this is experimental, and disables ctrl-clicks. It should not be |
| 17 // enabled other than through flags until we implement 3 finger drag as the | 17 // enabled other than through flags until we implement 3 finger drag as the |
| 18 // mechanism to invoke it. At that point we will add test coverage. | 18 // mechanism to invoke it. At that point we will add test coverage. |
| 19 class TabScrubber : public ui::EventHandler, | 19 class TabScrubber : public ui::EventHandler, |
| 20 public content::NotificationObserver { | 20 public content::NotificationObserver { |
| 21 public: | 21 public: |
| 22 static TabScrubber* GetInstance(); | 22 static TabScrubber* GetInstance(); |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 TabScrubber(); | 25 TabScrubber(); |
| 26 virtual ~TabScrubber(); | 26 virtual ~TabScrubber(); |
| 27 | 27 |
| 28 // ui::EventHandler overrides: | 28 // ui::EventHandler overrides: |
| 29 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 29 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
| 30 | 30 |
| 31 // content::NotificationObserver overrides: | 31 // content::NotificationObserver overrides: |
| 32 virtual void Observe(int type, | 32 virtual void Observe(int type, |
| 33 const content::NotificationSource& source, | 33 const content::NotificationSource& source, |
| 34 const content::NotificationDetails& details) OVERRIDE; | 34 const content::NotificationDetails& details) OVERRIDE; |
| 35 | 35 |
| 36 Browser* GetActiveBrowser(); | 36 Browser* GetActiveBrowser(); |
| 37 void StartScrubbing(); |
| 37 void StopScrubbing(); | 38 void StopScrubbing(); |
| 38 | 39 |
| 39 // Indicates that we are currently scrubbing. | 40 // Indicates that we are currently scrubbing. |
| 40 bool scrubbing_; | 41 bool scrubbing_; |
| 41 // The browser that we are scrubbing. | 42 // The browser that we are scrubbing. |
| 42 Browser* browser_; | 43 Browser* browser_; |
| 43 // The tab that was active when we started scrubbing. | |
| 44 int initial_tab_index_; | |
| 45 // The x value of the event that initiated scrubbing. | 44 // The x value of the event that initiated scrubbing. |
| 46 int initial_x_; | 45 float scroll_x_; |
| 46 float scroll_y_; |
| 47 | 47 |
| 48 content::NotificationRegistrar registrar_; | 48 content::NotificationRegistrar registrar_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(TabScrubber); | 50 DISALLOW_COPY_AND_ASSIGN(TabScrubber); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 #endif // CHROME_BROWSER_UI_VIEWS_ASH_TAB_SCRUBBER_H_ | 53 #endif // CHROME_BROWSER_UI_VIEWS_ASH_TAB_SCRUBBER_H_ |
| OLD | NEW |