| 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/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 static_cast<BrowserTabStripController*>(other->controller())->profile(); | 301 static_cast<BrowserTabStripController*>(other->controller())->profile(); |
| 302 return other_profile == profile(); | 302 return other_profile == profile(); |
| 303 } | 303 } |
| 304 | 304 |
| 305 void BrowserTabStripController::CreateNewTab() { | 305 void BrowserTabStripController::CreateNewTab() { |
| 306 UserMetrics::RecordAction(UserMetricsAction("NewTab_Button")); | 306 UserMetrics::RecordAction(UserMetricsAction("NewTab_Button")); |
| 307 | 307 |
| 308 model_->delegate()->AddBlankTab(true); | 308 model_->delegate()->AddBlankTab(true); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void BrowserTabStripController::ReselectTab(int index) { |
| 312 DCHECK(model_->active_index() == index); |
| 313 model_->TabReselected(index); |
| 314 } |
| 315 |
| 311 //////////////////////////////////////////////////////////////////////////////// | 316 //////////////////////////////////////////////////////////////////////////////// |
| 312 // BrowserTabStripController, TabStripModelObserver implementation: | 317 // BrowserTabStripController, TabStripModelObserver implementation: |
| 313 | 318 |
| 314 void BrowserTabStripController::TabInsertedAt(TabContentsWrapper* contents, | 319 void BrowserTabStripController::TabInsertedAt(TabContentsWrapper* contents, |
| 315 int model_index, | 320 int model_index, |
| 316 bool active) { | 321 bool active) { |
| 317 DCHECK(contents); | 322 DCHECK(contents); |
| 318 DCHECK(model_index == TabStripModel::kNoTab || | 323 DCHECK(model_index == TabStripModel::kNoTab || |
| 319 model_->ContainsIndex(model_index)); | 324 model_->ContainsIndex(model_index)); |
| 320 | 325 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 DCHECK(type.value == NotificationType::TAB_CLOSEABLE_STATE_CHANGED); | 470 DCHECK(type.value == NotificationType::TAB_CLOSEABLE_STATE_CHANGED); |
| 466 // Note that this notification may be fired during a model mutation and | 471 // Note that this notification may be fired during a model mutation and |
| 467 // possibly before the tabstrip has processed the change. | 472 // possibly before the tabstrip has processed the change. |
| 468 // Here, we just re-layout each existing tab to reflect the change in its | 473 // Here, we just re-layout each existing tab to reflect the change in its |
| 469 // closeable state, and then schedule paint for entire tabstrip. | 474 // closeable state, and then schedule paint for entire tabstrip. |
| 470 for (int i = 0; i < tabstrip_->tab_count(); ++i) { | 475 for (int i = 0; i < tabstrip_->tab_count(); ++i) { |
| 471 tabstrip_->base_tab_at_tab_index(i)->Layout(); | 476 tabstrip_->base_tab_at_tab_index(i)->Layout(); |
| 472 } | 477 } |
| 473 tabstrip_->SchedulePaint(); | 478 tabstrip_->SchedulePaint(); |
| 474 } | 479 } |
| OLD | NEW |