OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_tab_strip_controller.h" | 5 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/browser/extensions/extension_tab_helper.h" | 9 #include "chrome/browser/extensions/extension_tab_helper.h" |
10 #include "chrome/browser/favicon/favicon_tab_helper.h" | 10 #include "chrome/browser/favicon/favicon_tab_helper.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/tabs/tab_strip_model.h" | 12 #include "chrome/browser/tabs/tab_strip_model.h" |
| 13 #include "chrome/browser/tabs/tab_strip_selection_model.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
15 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 16 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
16 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" | 17 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" |
17 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" | 18 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" |
18 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
19 #include "content/browser/renderer_host/render_view_host.h" | 20 #include "content/browser/renderer_host/render_view_host.h" |
20 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
21 #include "content/browser/user_metrics.h" | 22 #include "content/browser/user_metrics.h" |
22 #include "content/common/notification_service.h" | 23 #include "content/common/notification_service.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 335 } |
335 | 336 |
336 void BrowserTabStripController::TabDetachedAt(TabContentsWrapper* contents, | 337 void BrowserTabStripController::TabDetachedAt(TabContentsWrapper* contents, |
337 int model_index) { | 338 int model_index) { |
338 // Cancel any pending tab transition. | 339 // Cancel any pending tab transition. |
339 hover_tab_selector_.CancelTabTransition(); | 340 hover_tab_selector_.CancelTabTransition(); |
340 | 341 |
341 tabstrip_->RemoveTabAt(model_index); | 342 tabstrip_->RemoveTabAt(model_index); |
342 } | 343 } |
343 | 344 |
344 void BrowserTabStripController::ActiveTabChanged( | 345 void BrowserTabStripController::TabSelectionChanged( |
345 TabContentsWrapper* old_contents, | 346 const TabStripSelectionModel& old_model) { |
346 TabContentsWrapper* contents, | 347 tabstrip_->SetSelection(old_model, model_->selection_model()); |
347 int model_index, | |
348 bool user_gesture) { | |
349 tabstrip_->SelectTabAt(model_->GetIndexOfTabContents(old_contents), | |
350 model_index); | |
351 } | 348 } |
352 | 349 |
353 void BrowserTabStripController::TabMoved(TabContentsWrapper* contents, | 350 void BrowserTabStripController::TabMoved(TabContentsWrapper* contents, |
354 int from_model_index, | 351 int from_model_index, |
355 int to_model_index) { | 352 int to_model_index) { |
356 // Cancel any pending tab transition. | 353 // Cancel any pending tab transition. |
357 hover_tab_selector_.CancelTabTransition(); | 354 hover_tab_selector_.CancelTabTransition(); |
358 | 355 |
359 // Update the data first as the pinned state may have changed. | 356 // Update the data first as the pinned state may have changed. |
360 TabRendererData data; | 357 TabRendererData data; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 TabStripModel::ContextMenuCommand command_id, | 474 TabStripModel::ContextMenuCommand command_id, |
478 BaseTab* tab) { | 475 BaseTab* tab) { |
479 if (command_id == TabStripModel::CommandCloseTabsToRight || | 476 if (command_id == TabStripModel::CommandCloseTabsToRight || |
480 command_id == TabStripModel::CommandCloseOtherTabs) { | 477 command_id == TabStripModel::CommandCloseOtherTabs) { |
481 // Just tell all Tabs to stop pulsing - it's safe. | 478 // Just tell all Tabs to stop pulsing - it's safe. |
482 tabstrip_->StopAllHighlighting(); | 479 tabstrip_->StopAllHighlighting(); |
483 } | 480 } |
484 } | 481 } |
485 | 482 |
486 | 483 |
OLD | NEW |