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

Unified Diff: chrome/browser/ui/views/ash/tab_scrubber.h

Issue 12096014: Highlight tabs while scrubbing Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review issues Created 7 years, 11 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
Index: chrome/browser/ui/views/ash/tab_scrubber.h
diff --git a/chrome/browser/ui/views/ash/tab_scrubber.h b/chrome/browser/ui/views/ash/tab_scrubber.h
index 8ba03d5d6b30781663d9965561fa952e0c1a53c9..43ddfbf5b6a98a2f63d2e12a6e4020ead7438d0d 100644
--- a/chrome/browser/ui/views/ash/tab_scrubber.h
+++ b/chrome/browser/ui/views/ash/tab_scrubber.h
@@ -5,12 +5,18 @@
#ifndef CHROME_BROWSER_UI_VIEWS_ASH_TAB_SCRUBBER_H_
#define CHROME_BROWSER_UI_VIEWS_ASH_TAB_SCRUBBER_H_
+#include "base/timer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
#include "ui/base/events/event_handler.h"
class Browser;
-class Tab;
+class TabStrip;
+
+namespace gfx {
+class Point;
+}
// Class to enable quick tab switching via Ctrl-left-drag.
// Notes: this is experimental, and disables ctrl-clicks. It should not be
@@ -19,8 +25,22 @@ class Tab;
class TabScrubber : public ui::EventHandler,
public content::NotificationObserver {
public:
+ enum Direction {LEFT, RIGHT};
+
+ // Returns a the single instance of a TabScrubber.
static TabScrubber* GetInstance();
+ // Returns the virtual position of a swipe starting in the tab at |index|,
+ // base on the |direction|.
+ static gfx::Point GetStartPoint(TabStrip* tab_strip,
+ int index,
+ TabScrubber::Direction direction);
+
+ void set_activation_delay(base::TimeDelta activation_delay) {
+ activation_delay_ = activation_delay;
+ }
+ base::TimeDelta activation_delay() const { return activation_delay_; }
+
private:
TabScrubber();
virtual ~TabScrubber();
@@ -34,18 +54,36 @@ class TabScrubber : public ui::EventHandler,
const content::NotificationDetails& details) OVERRIDE;
Browser* GetActiveBrowser();
- void StartScrubbing();
- void StopScrubbing();
+ void FinishScrub(bool activate);
+ void CancelImmersiveReveal();
- // Indicates that we are currently scrubbing.
+ // Are we currently scrubbing?.
bool scrubbing_;
- // The browser that we are scrubbing.
+ // The last browser we used for scrubbing, NULL if |scrubbing_| is
+ // false and there is no pending work.
Browser* browser_;
- // The x value of the event that initiated scrubbing.
- float scroll_x_;
- float scroll_y_;
+ // The current accumulated x and y positions of a swipe, in
+ // the coordinates of the TabStrip of |browser_|
+ float swipe_x_;
+ float swipe_y_;
+ // The direction the current swipe is headed.
+ Direction swipe_direction_;
+ // The index of the tab that is currently highlighted.
+ int highlighted_tab_;
+ // Timer to control a delayed activation of the |highlighted_tab_|.
+ base::Timer activate_timer_;
+ // Time to wait before newly selected tab becomes active.
+ base::TimeDelta activation_delay_;
+ // Indicates if we were in immersive mode and forced the tabs to be
+ // revealed.
+ bool should_cancel_immersive_reveal_;
+ // Timer to control the cancel of an immersive reveal.
+ base::Timer cancel_immersive_reveal_timer_;
content::NotificationRegistrar registrar_;
+ // Note: This should remain the last member so it'll be destroyed and
+ // invalidate its weak pointers before any other members are destroyed.
+ base::WeakPtrFactory<TabScrubber> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(TabScrubber);
};
« no previous file with comments | « no previous file | chrome/browser/ui/views/ash/tab_scrubber.cc » ('j') | chrome/browser/ui/views/ash/tab_scrubber.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698