| 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/favicon_tab_helper.h" | 10 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/views/controls/menu/menu_model_adapter.h" | 26 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 27 #include "ui/views/controls/menu/menu_runner.h" | 27 #include "ui/views/controls/menu/menu_runner.h" |
| 28 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
| 29 | 29 |
| 30 using content::UserMetricsAction; | 30 using content::UserMetricsAction; |
| 31 | 31 |
| 32 static TabRendererData::NetworkState TabContentsNetworkState( | 32 static TabRendererData::NetworkState TabContentsNetworkState( |
| 33 TabContents* contents) { | 33 TabContents* contents) { |
| 34 if (!contents || !contents->IsLoading()) | 34 if (!contents || !contents->IsLoading()) |
| 35 return TabRendererData::NETWORK_STATE_NONE; | 35 return TabRendererData::NETWORK_STATE_NONE; |
| 36 if (contents->waiting_for_response()) | 36 if (contents->IsWaitingForResponse()) |
| 37 return TabRendererData::NETWORK_STATE_WAITING; | 37 return TabRendererData::NETWORK_STATE_WAITING; |
| 38 return TabRendererData::NETWORK_STATE_LOADING; | 38 return TabRendererData::NETWORK_STATE_LOADING; |
| 39 } | 39 } |
| 40 | 40 |
| 41 class BrowserTabStripController::TabContextMenuContents | 41 class BrowserTabStripController::TabContextMenuContents |
| 42 : public ui::SimpleMenuModel::Delegate { | 42 : public ui::SimpleMenuModel::Delegate { |
| 43 public: | 43 public: |
| 44 TabContextMenuContents(BaseTab* tab, | 44 TabContextMenuContents(BaseTab* tab, |
| 45 BrowserTabStripController* controller) | 45 BrowserTabStripController* controller) |
| 46 : tab_(tab), | 46 : tab_(tab), |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 app_icon = wrapper->extension_tab_helper()->GetExtensionAppIcon(); | 430 app_icon = wrapper->extension_tab_helper()->GetExtensionAppIcon(); |
| 431 | 431 |
| 432 if (app_icon) | 432 if (app_icon) |
| 433 data->favicon = *app_icon; | 433 data->favicon = *app_icon; |
| 434 else | 434 else |
| 435 data->favicon = wrapper->favicon_tab_helper()->GetFavicon(); | 435 data->favicon = wrapper->favicon_tab_helper()->GetFavicon(); |
| 436 data->network_state = TabContentsNetworkState(contents); | 436 data->network_state = TabContentsNetworkState(contents); |
| 437 data->title = contents->GetTitle(); | 437 data->title = contents->GetTitle(); |
| 438 data->url = contents->GetURL(); | 438 data->url = contents->GetURL(); |
| 439 data->loading = contents->IsLoading(); | 439 data->loading = contents->IsLoading(); |
| 440 data->crashed_status = contents->crashed_status(); | 440 data->crashed_status = contents->GetCrashedStatus(); |
| 441 data->incognito = contents->GetBrowserContext()->IsOffTheRecord(); | 441 data->incognito = contents->GetBrowserContext()->IsOffTheRecord(); |
| 442 data->show_icon = wrapper->favicon_tab_helper()->ShouldDisplayFavicon(); | 442 data->show_icon = wrapper->favicon_tab_helper()->ShouldDisplayFavicon(); |
| 443 data->mini = model_->IsMiniTab(model_index); | 443 data->mini = model_->IsMiniTab(model_index); |
| 444 data->blocked = model_->IsTabBlocked(model_index); | 444 data->blocked = model_->IsTabBlocked(model_index); |
| 445 data->app = wrapper->extension_tab_helper()->is_app(); | 445 data->app = wrapper->extension_tab_helper()->is_app(); |
| 446 } | 446 } |
| 447 | 447 |
| 448 void BrowserTabStripController::SetTabDataAt( | 448 void BrowserTabStripController::SetTabDataAt( |
| 449 TabContentsWrapper* contents, | 449 TabContentsWrapper* contents, |
| 450 int model_index) { | 450 int model_index) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 473 | 473 |
| 474 void BrowserTabStripController::StopHighlightTabsForCommand( | 474 void BrowserTabStripController::StopHighlightTabsForCommand( |
| 475 TabStripModel::ContextMenuCommand command_id, | 475 TabStripModel::ContextMenuCommand command_id, |
| 476 BaseTab* tab) { | 476 BaseTab* tab) { |
| 477 if (command_id == TabStripModel::CommandCloseTabsToRight || | 477 if (command_id == TabStripModel::CommandCloseTabsToRight || |
| 478 command_id == TabStripModel::CommandCloseOtherTabs) { | 478 command_id == TabStripModel::CommandCloseOtherTabs) { |
| 479 // Just tell all Tabs to stop pulsing - it's safe. | 479 // Just tell all Tabs to stop pulsing - it's safe. |
| 480 tabstrip_->StopAllHighlighting(); | 480 tabstrip_->StopAllHighlighting(); |
| 481 } | 481 } |
| 482 } | 482 } |
| OLD | NEW |