| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_GTK_TABS_TAB_STRIP_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ | 6 #define CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // Layout method and other callers like the DraggedTabController that need | 311 // Layout method and other callers like the DraggedTabController that need |
| 312 // stable representations of Tab positions. | 312 // stable representations of Tab positions. |
| 313 void GenerateIdealBounds(); | 313 void GenerateIdealBounds(); |
| 314 | 314 |
| 315 // Lays out the New Tab button, assuming the right edge of the last Tab on | 315 // Lays out the New Tab button, assuming the right edge of the last Tab on |
| 316 // the TabStrip at |last_tab_right|. |unselected_width| is the width of | 316 // the TabStrip at |last_tab_right|. |unselected_width| is the width of |
| 317 // unselected tabs at the moment this function is called. The value changes | 317 // unselected tabs at the moment this function is called. The value changes |
| 318 // during animations, so we can't use current_unselected_width_. | 318 // during animations, so we can't use current_unselected_width_. |
| 319 void LayoutNewTabButton(double last_tab_right, double unselected_width); | 319 void LayoutNewTabButton(double last_tab_right, double unselected_width); |
| 320 | 320 |
| 321 #if defined(OS_CHROMEOS) | |
| 322 // Positions the tab overview button. | |
| 323 void LayoutTabOverviewButton(); | |
| 324 #endif | |
| 325 | |
| 326 // -- Link Drag & Drop ------------------------------------------------------ | 321 // -- Link Drag & Drop ------------------------------------------------------ |
| 327 | 322 |
| 328 // Returns the bounds to render the drop at, in screen coordinates. Sets | 323 // Returns the bounds to render the drop at, in screen coordinates. Sets |
| 329 // |is_beneath| to indicate whether the arrow is beneath the tab, or above | 324 // |is_beneath| to indicate whether the arrow is beneath the tab, or above |
| 330 // it. | 325 // it. |
| 331 gfx::Rect GetDropBounds(int drop_index, bool drop_before, bool* is_beneath); | 326 gfx::Rect GetDropBounds(int drop_index, bool drop_before, bool* is_beneath); |
| 332 | 327 |
| 333 // Updates the location of the drop based on the event. | 328 // Updates the location of the drop based on the event. |
| 334 void UpdateDropIndex(GdkDragContext* context, gint x, gint y); | 329 void UpdateDropIndex(GdkDragContext* context, gint x, gint y); |
| 335 | 330 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 363 // Returns true if detach or select changes in the model should be reflected | 358 // Returns true if detach or select changes in the model should be reflected |
| 364 // in the TabStrip. This returns false if we're closing all tabs in the | 359 // in the TabStrip. This returns false if we're closing all tabs in the |
| 365 // TabStrip and so we should prevent updating. This is not const because we | 360 // TabStrip and so we should prevent updating. This is not const because we |
| 366 // use this as a signal to cancel any active animations. | 361 // use this as a signal to cancel any active animations. |
| 367 bool CanUpdateDisplay(); | 362 bool CanUpdateDisplay(); |
| 368 | 363 |
| 369 // Notifies the TabStrip that the specified TabAnimation has completed. | 364 // Notifies the TabStrip that the specified TabAnimation has completed. |
| 370 // Optionally a full Layout will be performed, specified by |layout|. | 365 // Optionally a full Layout will be performed, specified by |layout|. |
| 371 void FinishAnimation(TabAnimation* animation, bool layout); | 366 void FinishAnimation(TabAnimation* animation, bool layout); |
| 372 | 367 |
| 373 #if defined(OS_CHROMEOS) | |
| 374 // Creates and returns the tab overview button. | |
| 375 CustomDrawButton* MakeTabOverviewButton(); | |
| 376 | |
| 377 // Invoked when the user clicks the tab overview button. | |
| 378 static void OnTabOverviewButtonClicked(GtkWidget* widget, | |
| 379 TabStripGtk* tabstrip); | |
| 380 #endif | |
| 381 | |
| 382 NotificationRegistrar registrar_; | 368 NotificationRegistrar registrar_; |
| 383 | 369 |
| 384 // The Tabs we contain, and their last generated "good" bounds. | 370 // The Tabs we contain, and their last generated "good" bounds. |
| 385 std::vector<TabData> tab_data_; | 371 std::vector<TabData> tab_data_; |
| 386 | 372 |
| 387 // The current widths of various types of tabs. We save these so that, as | 373 // The current widths of various types of tabs. We save these so that, as |
| 388 // users close tabs while we're holding them at the same size, we can lay out | 374 // users close tabs while we're holding them at the same size, we can lay out |
| 389 // tabs exactly and eliminate the "pixel jitter" we'd get from just leaving | 375 // tabs exactly and eliminate the "pixel jitter" we'd get from just leaving |
| 390 // them all at their existing, rounded widths. | 376 // them all at their existing, rounded widths. |
| 391 double current_unselected_width_; | 377 double current_unselected_width_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 416 | 402 |
| 417 // Theme resources. | 403 // Theme resources. |
| 418 GtkThemeProvider* theme_provider_; | 404 GtkThemeProvider* theme_provider_; |
| 419 | 405 |
| 420 // The currently running animation. | 406 // The currently running animation. |
| 421 scoped_ptr<TabAnimation> active_animation_; | 407 scoped_ptr<TabAnimation> active_animation_; |
| 422 | 408 |
| 423 // The New Tab button. | 409 // The New Tab button. |
| 424 scoped_ptr<CustomDrawButton> newtab_button_; | 410 scoped_ptr<CustomDrawButton> newtab_button_; |
| 425 | 411 |
| 426 #if defined(OS_CHROMEOS) | |
| 427 // The tab overview button. | |
| 428 scoped_ptr<CustomDrawButton> tab_overview_button_; | |
| 429 #endif | |
| 430 | |
| 431 // Valid for the lifetime of a drag over us. | 412 // Valid for the lifetime of a drag over us. |
| 432 scoped_ptr<DropInfo> drop_info_; | 413 scoped_ptr<DropInfo> drop_info_; |
| 433 | 414 |
| 434 // The controller for a drag initiated from a Tab. Valid for the lifetime of | 415 // The controller for a drag initiated from a Tab. Valid for the lifetime of |
| 435 // the drag session. | 416 // the drag session. |
| 436 scoped_ptr<DraggedTabControllerGtk> drag_controller_; | 417 scoped_ptr<DraggedTabControllerGtk> drag_controller_; |
| 437 | 418 |
| 438 // A factory that is used to construct a delayed callback to the | 419 // A factory that is used to construct a delayed callback to the |
| 439 // ResizeLayoutTabsNow method. | 420 // ResizeLayoutTabsNow method. |
| 440 ScopedRunnableMethodFactory<TabStripGtk> resize_layout_factory_; | 421 ScopedRunnableMethodFactory<TabStripGtk> resize_layout_factory_; |
| 441 | 422 |
| 442 // True if the tabstrip has already been added as a MessageLoop observer. | 423 // True if the tabstrip has already been added as a MessageLoop observer. |
| 443 bool added_as_message_loop_observer_; | 424 bool added_as_message_loop_observer_; |
| 444 | 425 |
| 445 DISALLOW_COPY_AND_ASSIGN(TabStripGtk); | 426 DISALLOW_COPY_AND_ASSIGN(TabStripGtk); |
| 446 }; | 427 }; |
| 447 | 428 |
| 448 #endif // CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ | 429 #endif // CHROME_BROWSER_GTK_TABS_TAB_STRIP_GTK_H_ |
| OLD | NEW |