| 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/tabs/tab_strip_model_order_controller.h" | 5 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 8 | 8 |
| 9 /////////////////////////////////////////////////////////////////////////////// | 9 /////////////////////////////////////////////////////////////////////////////// |
| 10 // TabStripModelOrderController, public: | 10 // TabStripModelOrderController, public: |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 // No opener set, fall through to the default handler... | 101 // No opener set, fall through to the default handler... |
| 102 int selected_index = tabstrip_->active_index(); | 102 int selected_index = tabstrip_->active_index(); |
| 103 if (selected_index >= (tab_count - 1)) | 103 if (selected_index >= (tab_count - 1)) |
| 104 return selected_index - 1; | 104 return selected_index - 1; |
| 105 | 105 |
| 106 return selected_index; | 106 return selected_index; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void TabStripModelOrderController::TabSelectedAt( | 109 void TabStripModelOrderController::ActiveTabChanged( |
| 110 TabContentsWrapper* old_contents, | 110 TabContentsWrapper* old_contents, |
| 111 TabContentsWrapper* new_contents, | 111 TabContentsWrapper* new_contents, |
| 112 int index, | 112 int index, |
| 113 bool user_gesture) { | 113 bool user_gesture) { |
| 114 if (old_contents == new_contents) | 114 if (old_contents == new_contents) |
| 115 return; | 115 return; |
| 116 | 116 |
| 117 NavigationController* old_opener = NULL; | 117 NavigationController* old_opener = NULL; |
| 118 if (old_contents) { | 118 if (old_contents) { |
| 119 int index = tabstrip_->GetIndexOfTabContents(old_contents); | 119 int index = tabstrip_->GetIndexOfTabContents(old_contents); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 137 | 137 |
| 138 /////////////////////////////////////////////////////////////////////////////// | 138 /////////////////////////////////////////////////////////////////////////////// |
| 139 // TabStripModelOrderController, private: | 139 // TabStripModelOrderController, private: |
| 140 | 140 |
| 141 int TabStripModelOrderController::GetValidIndex( | 141 int TabStripModelOrderController::GetValidIndex( |
| 142 int index, int removing_index) const { | 142 int index, int removing_index) const { |
| 143 if (removing_index < index) | 143 if (removing_index < index) |
| 144 index = std::max(0, index - 1); | 144 index = std::max(0, index - 1); |
| 145 return index; | 145 return index; |
| 146 } | 146 } |
| OLD | NEW |