| 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_tab_helper.h" |
| 10 #include "chrome/browser/metrics/user_metrics.h" | 11 #include "chrome/browser/metrics/user_metrics.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/tabs/tab_strip_model.h" | 13 #include "chrome/browser/tabs/tab_strip_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" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 TabContentsWrapper::GetCurrentWrapperForContents(contents); | 394 TabContentsWrapper::GetCurrentWrapperForContents(contents); |
| 394 | 395 |
| 395 // Extension App icons are slightly larger than favicons, so only allow | 396 // Extension App icons are slightly larger than favicons, so only allow |
| 396 // them if permitted by the model. | 397 // them if permitted by the model. |
| 397 if (model_->delegate()->LargeIconsPermitted()) | 398 if (model_->delegate()->LargeIconsPermitted()) |
| 398 app_icon = wrapper->extension_tab_helper()->GetExtensionAppIcon(); | 399 app_icon = wrapper->extension_tab_helper()->GetExtensionAppIcon(); |
| 399 | 400 |
| 400 if (app_icon) | 401 if (app_icon) |
| 401 data->favicon = *app_icon; | 402 data->favicon = *app_icon; |
| 402 else | 403 else |
| 403 data->favicon = contents->GetFavicon(); | 404 data->favicon = wrapper->favicon_tab_helper()->GetFavicon(); |
| 404 data->network_state = TabContentsNetworkState(contents); | 405 data->network_state = TabContentsNetworkState(contents); |
| 405 data->title = contents->GetTitle(); | 406 data->title = contents->GetTitle(); |
| 406 data->loading = contents->is_loading(); | 407 data->loading = contents->is_loading(); |
| 407 data->crashed_status = contents->crashed_status(); | 408 data->crashed_status = contents->crashed_status(); |
| 408 data->incognito = contents->profile()->IsOffTheRecord(); | 409 data->incognito = contents->profile()->IsOffTheRecord(); |
| 409 data->show_icon = contents->ShouldDisplayFavicon(); | 410 data->show_icon = wrapper->favicon_tab_helper()->ShouldDisplayFavicon(); |
| 410 data->mini = model_->IsMiniTab(model_index); | 411 data->mini = model_->IsMiniTab(model_index); |
| 411 data->blocked = model_->IsTabBlocked(model_index); | 412 data->blocked = model_->IsTabBlocked(model_index); |
| 412 data->app = wrapper->extension_tab_helper()->is_app(); | 413 data->app = wrapper->extension_tab_helper()->is_app(); |
| 413 } | 414 } |
| 414 | 415 |
| 415 void BrowserTabStripController::StartHighlightTabsForCommand( | 416 void BrowserTabStripController::StartHighlightTabsForCommand( |
| 416 TabStripModel::ContextMenuCommand command_id, | 417 TabStripModel::ContextMenuCommand command_id, |
| 417 BaseTab* tab) { | 418 BaseTab* tab) { |
| 418 if (command_id == TabStripModel::CommandCloseOtherTabs || | 419 if (command_id == TabStripModel::CommandCloseOtherTabs || |
| 419 command_id == TabStripModel::CommandCloseTabsToRight) { | 420 command_id == TabStripModel::CommandCloseTabsToRight) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 447 DCHECK(type.value == NotificationType::TAB_CLOSEABLE_STATE_CHANGED); | 448 DCHECK(type.value == NotificationType::TAB_CLOSEABLE_STATE_CHANGED); |
| 448 // Note that this notification may be fired during a model mutation and | 449 // Note that this notification may be fired during a model mutation and |
| 449 // possibly before the tabstrip has processed the change. | 450 // possibly before the tabstrip has processed the change. |
| 450 // Here, we just re-layout each existing tab to reflect the change in its | 451 // Here, we just re-layout each existing tab to reflect the change in its |
| 451 // closeable state, and then schedule paint for entire tabstrip. | 452 // closeable state, and then schedule paint for entire tabstrip. |
| 452 for (int i = 0; i < tabstrip_->tab_count(); ++i) { | 453 for (int i = 0; i < tabstrip_->tab_count(); ++i) { |
| 453 tabstrip_->base_tab_at_tab_index(i)->Layout(); | 454 tabstrip_->base_tab_at_tab_index(i)->Layout(); |
| 454 } | 455 } |
| 455 tabstrip_->SchedulePaint(); | 456 tabstrip_->SchedulePaint(); |
| 456 } | 457 } |
| OLD | NEW |