| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/task_runner_util.h" | 9 #include "base/task_runner_util.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 tabstrip_->PrepareForCloseAt(model_index, source); | 289 tabstrip_->PrepareForCloseAt(model_index, source); |
| 290 model_->CloseWebContentsAt(model_index, | 290 model_->CloseWebContentsAt(model_index, |
| 291 TabStripModel::CLOSE_USER_GESTURE | | 291 TabStripModel::CLOSE_USER_GESTURE | |
| 292 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); | 292 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void BrowserTabStripController::ToggleTabAudioMute(int model_index) { | 295 void BrowserTabStripController::ToggleTabAudioMute(int model_index) { |
| 296 content::WebContents* const contents = model_->GetWebContentsAt(model_index); | 296 content::WebContents* const contents = model_->GetWebContentsAt(model_index); |
| 297 chrome::SetTabAudioMuted(contents, !contents->IsAudioMuted(), | 297 chrome::SetTabAudioMuted(contents, !contents->IsAudioMuted(), |
| 298 TAB_MUTED_REASON_AUDIO_INDICATOR, std::string()); | 298 TabMutedReason::AUDIO_INDICATOR, std::string()); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void BrowserTabStripController::ShowContextMenuForTab( | 301 void BrowserTabStripController::ShowContextMenuForTab( |
| 302 Tab* tab, | 302 Tab* tab, |
| 303 const gfx::Point& p, | 303 const gfx::Point& p, |
| 304 ui::MenuSourceType source_type) { | 304 ui::MenuSourceType source_type) { |
| 305 context_menu_contents_.reset(new TabContextMenuContents(tab, this)); | 305 context_menu_contents_.reset(new TabContextMenuContents(tab, this)); |
| 306 context_menu_contents_->RunMenuAt(p, source_type); | 306 context_menu_contents_->RunMenuAt(p, source_type); |
| 307 } | 307 } |
| 308 | 308 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 data->network_state = TabContentsNetworkState(contents); | 498 data->network_state = TabContentsNetworkState(contents); |
| 499 data->title = contents->GetTitle(); | 499 data->title = contents->GetTitle(); |
| 500 data->url = contents->GetURL(); | 500 data->url = contents->GetURL(); |
| 501 data->loading = contents->IsLoading(); | 501 data->loading = contents->IsLoading(); |
| 502 data->crashed_status = contents->GetCrashedStatus(); | 502 data->crashed_status = contents->GetCrashedStatus(); |
| 503 data->incognito = contents->GetBrowserContext()->IsOffTheRecord(); | 503 data->incognito = contents->GetBrowserContext()->IsOffTheRecord(); |
| 504 data->pinned = model_->IsTabPinned(model_index); | 504 data->pinned = model_->IsTabPinned(model_index); |
| 505 data->show_icon = data->pinned || favicon::ShouldDisplayFavicon(contents); | 505 data->show_icon = data->pinned || favicon::ShouldDisplayFavicon(contents); |
| 506 data->blocked = model_->IsTabBlocked(model_index); | 506 data->blocked = model_->IsTabBlocked(model_index); |
| 507 data->app = extensions::TabHelper::FromWebContents(contents)->is_app(); | 507 data->app = extensions::TabHelper::FromWebContents(contents)->is_app(); |
| 508 data->media_state = chrome::GetTabMediaStateForContents(contents); | 508 data->alert_state = chrome::GetTabAlertStateForContents(contents); |
| 509 } | 509 } |
| 510 | 510 |
| 511 void BrowserTabStripController::SetTabDataAt(content::WebContents* web_contents, | 511 void BrowserTabStripController::SetTabDataAt(content::WebContents* web_contents, |
| 512 int model_index) { | 512 int model_index) { |
| 513 TabRendererData data; | 513 TabRendererData data; |
| 514 SetTabRendererDataFromModel(web_contents, model_index, &data, EXISTING_TAB); | 514 SetTabRendererDataFromModel(web_contents, model_index, &data, EXISTING_TAB); |
| 515 tabstrip_->SetTabData(model_index, data); | 515 tabstrip_->SetTabData(model_index, data); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void BrowserTabStripController::StartHighlightTabsForCommand( | 518 void BrowserTabStripController::StartHighlightTabsForCommand( |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 content::WebPluginInfo plugin; | 571 content::WebPluginInfo plugin; |
| 572 tabstrip_->FileSupported( | 572 tabstrip_->FileSupported( |
| 573 url, | 573 url, |
| 574 mime_type.empty() || mime_util::IsSupportedMimeType(mime_type) || | 574 mime_type.empty() || mime_util::IsSupportedMimeType(mime_type) || |
| 575 content::PluginService::GetInstance()->GetPluginInfo( | 575 content::PluginService::GetInstance()->GetPluginInfo( |
| 576 -1, // process ID | 576 -1, // process ID |
| 577 MSG_ROUTING_NONE, // routing ID | 577 MSG_ROUTING_NONE, // routing ID |
| 578 model_->profile()->GetResourceContext(), url, GURL(), mime_type, | 578 model_->profile()->GetResourceContext(), url, GURL(), mime_type, |
| 579 false, NULL, &plugin, NULL)); | 579 false, NULL, &plugin, NULL)); |
| 580 } | 580 } |
| OLD | NEW |