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/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/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 } | 505 } |
506 | 506 |
507 void BrowserTabStripController::SetTabRendererDataFromModel( | 507 void BrowserTabStripController::SetTabRendererDataFromModel( |
508 WebContents* contents, | 508 WebContents* contents, |
509 int model_index, | 509 int model_index, |
510 TabRendererData* data, | 510 TabRendererData* data, |
511 TabStatus tab_status) { | 511 TabStatus tab_status) { |
512 TabContents* tab_contents = TabContents::FromWebContents(contents); | 512 TabContents* tab_contents = TabContents::FromWebContents(contents); |
513 | 513 |
514 // TODO: Convert data->favicon to gfx::Image. | 514 // TODO: Convert data->favicon to gfx::Image. |
515 data->favicon = | 515 const gfx::Image& icon = tab_contents->favicon_tab_helper()->GetFavicon(); |
516 tab_contents->favicon_tab_helper()->GetFavicon().AsBitmap(); | 516 data->favicon = icon.IsEmpty() ? SkBitmap() : *icon.ToSkBitmap(); |
517 data->network_state = TabContentsNetworkState(contents); | 517 data->network_state = TabContentsNetworkState(contents); |
518 data->title = contents->GetTitle(); | 518 data->title = contents->GetTitle(); |
519 data->url = contents->GetURL(); | 519 data->url = contents->GetURL(); |
520 data->loading = contents->IsLoading(); | 520 data->loading = contents->IsLoading(); |
521 data->crashed_status = contents->GetCrashedStatus(); | 521 data->crashed_status = contents->GetCrashedStatus(); |
522 data->incognito = contents->GetBrowserContext()->IsOffTheRecord(); | 522 data->incognito = contents->GetBrowserContext()->IsOffTheRecord(); |
523 data->show_icon = tab_contents->favicon_tab_helper()->ShouldDisplayFavicon(); | 523 data->show_icon = tab_contents->favicon_tab_helper()->ShouldDisplayFavicon(); |
524 data->mini = model_->IsMiniTab(model_index); | 524 data->mini = model_->IsMiniTab(model_index); |
525 data->blocked = model_->IsTabBlocked(model_index); | 525 data->blocked = model_->IsTabBlocked(model_index); |
526 data->app = tab_contents->extension_tab_helper()->is_app(); | 526 data->app = tab_contents->extension_tab_helper()->is_app(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 SetTabRendererDataFromModel(contents->web_contents(), index, &data, NEW_TAB); | 576 SetTabRendererDataFromModel(contents->web_contents(), index, &data, NEW_TAB); |
577 tabstrip_->AddTabAt(index, data, is_active); | 577 tabstrip_->AddTabAt(index, data, is_active); |
578 } | 578 } |
579 | 579 |
580 void BrowserTabStripController::UpdateLayoutType() { | 580 void BrowserTabStripController::UpdateLayoutType() { |
581 bool adjust_layout = false; | 581 bool adjust_layout = false; |
582 TabStripLayoutType layout_type = | 582 TabStripLayoutType layout_type = |
583 DetermineTabStripLayout(g_browser_process->local_state(), &adjust_layout); | 583 DetermineTabStripLayout(g_browser_process->local_state(), &adjust_layout); |
584 tabstrip_->SetLayoutType(layout_type, adjust_layout); | 584 tabstrip_->SetLayoutType(layout_type, adjust_layout); |
585 } | 585 } |
OLD | NEW |