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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 return clipboard_text; | 129 return clipboard_text; |
130 } | 130 } |
131 | 131 |
132 // Animation delegate used for any automatic tab movement. Hides the tab if it | 132 // Animation delegate used for any automatic tab movement. Hides the tab if it |
133 // is not fully visible within the tabstrip area, to prevent overflow clipping. | 133 // is not fully visible within the tabstrip area, to prevent overflow clipping. |
134 class TabAnimationDelegate : public gfx::AnimationDelegate { | 134 class TabAnimationDelegate : public gfx::AnimationDelegate { |
135 public: | 135 public: |
136 TabAnimationDelegate(TabStrip* tab_strip, Tab* tab); | 136 TabAnimationDelegate(TabStrip* tab_strip, Tab* tab); |
137 virtual ~TabAnimationDelegate(); | 137 virtual ~TabAnimationDelegate(); |
138 | 138 |
139 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 139 virtual void AnimationProgressed(const gfx::Animation* animation) override; |
140 | 140 |
141 protected: | 141 protected: |
142 TabStrip* tab_strip() { return tab_strip_; } | 142 TabStrip* tab_strip() { return tab_strip_; } |
143 Tab* tab() { return tab_; } | 143 Tab* tab() { return tab_; } |
144 | 144 |
145 private: | 145 private: |
146 TabStrip* const tab_strip_; | 146 TabStrip* const tab_strip_; |
147 Tab* const tab_; | 147 Tab* const tab_; |
148 | 148 |
149 DISALLOW_COPY_AND_ASSIGN(TabAnimationDelegate); | 149 DISALLOW_COPY_AND_ASSIGN(TabAnimationDelegate); |
(...skipping 12 matching lines...) Expand all Loading... |
162 tab_->SetVisible(tab_strip_->ShouldTabBeVisible(tab_)); | 162 tab_->SetVisible(tab_strip_->ShouldTabBeVisible(tab_)); |
163 } | 163 } |
164 | 164 |
165 // Animation delegate used when a dragged tab is released. When done sets the | 165 // Animation delegate used when a dragged tab is released. When done sets the |
166 // dragging state to false. | 166 // dragging state to false. |
167 class ResetDraggingStateDelegate : public TabAnimationDelegate { | 167 class ResetDraggingStateDelegate : public TabAnimationDelegate { |
168 public: | 168 public: |
169 ResetDraggingStateDelegate(TabStrip* tab_strip, Tab* tab); | 169 ResetDraggingStateDelegate(TabStrip* tab_strip, Tab* tab); |
170 virtual ~ResetDraggingStateDelegate(); | 170 virtual ~ResetDraggingStateDelegate(); |
171 | 171 |
172 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | 172 virtual void AnimationEnded(const gfx::Animation* animation) override; |
173 virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; | 173 virtual void AnimationCanceled(const gfx::Animation* animation) override; |
174 | 174 |
175 private: | 175 private: |
176 DISALLOW_COPY_AND_ASSIGN(ResetDraggingStateDelegate); | 176 DISALLOW_COPY_AND_ASSIGN(ResetDraggingStateDelegate); |
177 }; | 177 }; |
178 | 178 |
179 ResetDraggingStateDelegate::ResetDraggingStateDelegate(TabStrip* tab_strip, | 179 ResetDraggingStateDelegate::ResetDraggingStateDelegate(TabStrip* tab_strip, |
180 Tab* tab) | 180 Tab* tab) |
181 : TabAnimationDelegate(tab_strip, tab) { | 181 : TabAnimationDelegate(tab_strip, tab) { |
182 } | 182 } |
183 | 183 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 // Set the background offset used to match the background image to the frame | 241 // Set the background offset used to match the background image to the frame |
242 // image. | 242 // image. |
243 void set_background_offset(const gfx::Point& offset) { | 243 void set_background_offset(const gfx::Point& offset) { |
244 background_offset_ = offset; | 244 background_offset_ = offset; |
245 } | 245 } |
246 | 246 |
247 protected: | 247 protected: |
248 // views::View: | 248 // views::View: |
249 #if defined(OS_WIN) | 249 #if defined(OS_WIN) |
250 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 250 virtual void OnMouseReleased(const ui::MouseEvent& event) override; |
251 #endif | 251 #endif |
252 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 252 virtual void OnPaint(gfx::Canvas* canvas) override; |
253 | 253 |
254 // ui::EventHandler: | 254 // ui::EventHandler: |
255 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 255 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
256 | 256 |
257 private: | 257 private: |
258 // views::MaskedTargeterDelegate: | 258 // views::MaskedTargeterDelegate: |
259 virtual bool GetHitTestMask(gfx::Path* mask) const OVERRIDE; | 259 virtual bool GetHitTestMask(gfx::Path* mask) const override; |
260 | 260 |
261 bool ShouldWindowContentsBeTransparent() const; | 261 bool ShouldWindowContentsBeTransparent() const; |
262 gfx::ImageSkia GetBackgroundImage(views::CustomButton::ButtonState state, | 262 gfx::ImageSkia GetBackgroundImage(views::CustomButton::ButtonState state, |
263 float scale) const; | 263 float scale) const; |
264 gfx::ImageSkia GetImageForState(views::CustomButton::ButtonState state, | 264 gfx::ImageSkia GetImageForState(views::CustomButton::ButtonState state, |
265 float scale) const; | 265 float scale) const; |
266 gfx::ImageSkia GetImageForScale(float scale) const; | 266 gfx::ImageSkia GetImageForScale(float scale) const; |
267 | 267 |
268 // Tab strip that contains this button. | 268 // Tab strip that contains this button. |
269 TabStrip* tab_strip_; | 269 TabStrip* tab_strip_; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 469 |
470 /////////////////////////////////////////////////////////////////////////////// | 470 /////////////////////////////////////////////////////////////////////////////// |
471 // TabStrip::RemoveTabDelegate | 471 // TabStrip::RemoveTabDelegate |
472 // | 472 // |
473 // AnimationDelegate used when removing a tab. Does the necessary cleanup when | 473 // AnimationDelegate used when removing a tab. Does the necessary cleanup when |
474 // done. | 474 // done. |
475 class TabStrip::RemoveTabDelegate : public TabAnimationDelegate { | 475 class TabStrip::RemoveTabDelegate : public TabAnimationDelegate { |
476 public: | 476 public: |
477 RemoveTabDelegate(TabStrip* tab_strip, Tab* tab); | 477 RemoveTabDelegate(TabStrip* tab_strip, Tab* tab); |
478 | 478 |
479 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | 479 virtual void AnimationEnded(const gfx::Animation* animation) override; |
480 virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; | 480 virtual void AnimationCanceled(const gfx::Animation* animation) override; |
481 | 481 |
482 private: | 482 private: |
483 DISALLOW_COPY_AND_ASSIGN(RemoveTabDelegate); | 483 DISALLOW_COPY_AND_ASSIGN(RemoveTabDelegate); |
484 }; | 484 }; |
485 | 485 |
486 TabStrip::RemoveTabDelegate::RemoveTabDelegate(TabStrip* tab_strip, | 486 TabStrip::RemoveTabDelegate::RemoveTabDelegate(TabStrip* tab_strip, |
487 Tab* tab) | 487 Tab* tab) |
488 : TabAnimationDelegate(tab_strip, tab) { | 488 : TabAnimationDelegate(tab_strip, tab) { |
489 } | 489 } |
490 | 490 |
(...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2730 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2730 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
2731 if (view) | 2731 if (view) |
2732 return view; | 2732 return view; |
2733 } | 2733 } |
2734 Tab* tab = FindTabForEvent(point); | 2734 Tab* tab = FindTabForEvent(point); |
2735 if (tab) | 2735 if (tab) |
2736 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2736 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
2737 } | 2737 } |
2738 return this; | 2738 return this; |
2739 } | 2739 } |
OLD | NEW |