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/touch/tabs/touch_tab_strip.h" | 5 #include "chrome/browser/ui/touch/tabs/touch_tab_strip.h" |
6 | 6 |
7 #include "chrome/browser/ui/touch/tabs/touch_tab.h" | 7 #include "chrome/browser/ui/touch/tabs/touch_tab.h" |
8 #include "chrome/browser/ui/view_ids.h" | 8 #include "chrome/browser/ui/view_ids.h" |
9 #include "ui/gfx/canvas_skia.h" | 9 #include "ui/gfx/canvas_skia.h" |
10 #include "views/window/non_client_view.h" | 10 #include "views/window/non_client_view.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 TouchTab* dragging_tab = NULL; | 150 TouchTab* dragging_tab = NULL; |
151 | 151 |
152 for (int i = tab_count() - 1; i >= 0; --i) { | 152 for (int i = tab_count() - 1; i >= 0; --i) { |
153 TouchTab* tab = GetTabAtTabDataIndex(i); | 153 TouchTab* tab = GetTabAtTabDataIndex(i); |
154 // We must ask the _Tab's_ model, not ourselves, because in some situations | 154 // We must ask the _Tab's_ model, not ourselves, because in some situations |
155 // the model will be different to this object, e.g. when a Tab is being | 155 // the model will be different to this object, e.g. when a Tab is being |
156 // removed after its TabContents has been destroyed. | 156 // removed after its TabContents has been destroyed. |
157 if (tab->dragging()) { | 157 if (tab->dragging()) { |
158 dragging_tab = tab; | 158 dragging_tab = tab; |
159 } else if (!tab->IsSelected()) { | 159 } else if (!tab->IsSelected()) { |
160 tab->ProcessPaint(canvas); | 160 tab->Paint(canvas); |
161 } else { | 161 } else { |
162 selected_tab = tab; | 162 selected_tab = tab; |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 if (GetWindow()->GetNonClientView()->UseNativeFrame()) { | 166 if (GetWindow()->GetNonClientView()->UseNativeFrame()) { |
167 // Make sure unselected tabs are somewhat transparent. | 167 // Make sure unselected tabs are somewhat transparent. |
168 SkPaint paint; | 168 SkPaint paint; |
169 paint.setColor(SkColorSetARGB(200, 255, 255, 255)); | 169 paint.setColor(SkColorSetARGB(200, 255, 255, 255)); |
170 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); | 170 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); |
171 paint.setStyle(SkPaint::kFill_Style); | 171 paint.setStyle(SkPaint::kFill_Style); |
172 canvas->DrawRectInt(0, 0, width(), | 172 canvas->DrawRectInt(0, 0, width(), |
173 height() - 2, // Visible region that overlaps the toolbar. | 173 height() - 2, // Visible region that overlaps the toolbar. |
174 paint); | 174 paint); |
175 } | 175 } |
176 | 176 |
177 // Paint the selected tab last, so it overlaps all the others. | 177 // Paint the selected tab last, so it overlaps all the others. |
178 if (selected_tab) | 178 if (selected_tab) |
179 selected_tab->ProcessPaint(canvas); | 179 selected_tab->Paint(canvas); |
180 | 180 |
181 // And the dragged tab. | 181 // And the dragged tab. |
182 if (dragging_tab) | 182 if (dragging_tab) |
183 dragging_tab->ProcessPaint(canvas); | 183 dragging_tab->Paint(canvas); |
184 } | 184 } |
185 | 185 |
186 TouchTab* TouchTabStrip::GetTabAtTabDataIndex(int tab_data_index) const { | 186 TouchTab* TouchTabStrip::GetTabAtTabDataIndex(int tab_data_index) const { |
187 return static_cast<TouchTab*>(base_tab_at_tab_index(tab_data_index)); | 187 return static_cast<TouchTab*>(base_tab_at_tab_index(tab_data_index)); |
188 } | 188 } |
189 | 189 |
190 //////////////////////////////////////////////////////////////////////////////// | 190 //////////////////////////////////////////////////////////////////////////////// |
191 // TouchTabStrip, private: | 191 // TouchTabStrip, private: |
192 | 192 |
193 void TouchTabStrip::Init() { | 193 void TouchTabStrip::Init() { |
194 SetID(VIEW_ID_TAB_STRIP); | 194 SetID(VIEW_ID_TAB_STRIP); |
195 } | 195 } |
196 | 196 |
OLD | NEW |