| 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/fake_base_tab_strip_controller.h" | 5 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" | 7 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" |
| 8 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 8 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 9 | 9 |
| 10 FakeBaseTabStripController::FakeBaseTabStripController() | 10 FakeBaseTabStripController::FakeBaseTabStripController() |
| 11 : tab_strip_(NULL), | 11 : tab_strip_(NULL), |
| 12 num_tabs_(0), | 12 num_tabs_(0), |
| 13 active_index_(-1) { | 13 active_index_(-1) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 FakeBaseTabStripController::~FakeBaseTabStripController() { | 16 FakeBaseTabStripController::~FakeBaseTabStripController() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 void FakeBaseTabStripController::AddTab(int index, bool is_active) { | 19 void FakeBaseTabStripController::AddTab(int index, bool is_active) { |
| 20 num_tabs_++; | 20 num_tabs_++; |
| 21 tab_strip_->AddTabAt(index, TabRendererData(), is_active); | 21 tab_strip_->AddTabAt(index, TabRendererData(), is_active); |
| 22 if (is_active) | 22 if (is_active) |
| 23 active_index_ = index; | 23 active_index_ = index; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void FakeBaseTabStripController::AddPinnedTab(int index, bool is_active) { |
| 27 TabRendererData data; |
| 28 data.pinned = true; |
| 29 num_tabs_++; |
| 30 tab_strip_->AddTabAt(index, data, is_active); |
| 31 if (is_active) |
| 32 active_index_ = index; |
| 33 } |
| 34 |
| 26 void FakeBaseTabStripController::RemoveTab(int index) { | 35 void FakeBaseTabStripController::RemoveTab(int index) { |
| 27 num_tabs_--; | 36 num_tabs_--; |
| 28 tab_strip_->RemoveTabAt(index); | 37 tab_strip_->RemoveTabAt(index); |
| 29 if (active_index_ == index) | 38 if (active_index_ == index) |
| 30 active_index_ = -1; | 39 active_index_ = -1; |
| 31 } | 40 } |
| 32 | 41 |
| 33 const ui::ListSelectionModel& | 42 const ui::ListSelectionModel& |
| 34 FakeBaseTabStripController::GetSelectionModel() const { | 43 FakeBaseTabStripController::GetSelectionModel() const { |
| 35 return selection_model_; | 44 return selection_model_; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 141 |
| 133 void FakeBaseTabStripController::OnStartedDraggingTabs() { | 142 void FakeBaseTabStripController::OnStartedDraggingTabs() { |
| 134 } | 143 } |
| 135 | 144 |
| 136 void FakeBaseTabStripController::OnStoppedDraggingTabs() { | 145 void FakeBaseTabStripController::OnStoppedDraggingTabs() { |
| 137 } | 146 } |
| 138 | 147 |
| 139 void FakeBaseTabStripController::CheckFileSupported(const GURL& url) { | 148 void FakeBaseTabStripController::CheckFileSupported(const GURL& url) { |
| 140 tab_strip_->FileSupported(url, true); | 149 tab_strip_->FileSupported(url, true); |
| 141 } | 150 } |
| OLD | NEW |