| 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 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 28 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 31 #include "components/favicon/content/content_favicon_driver.h" | 31 #include "components/favicon/content/content_favicon_driver.h" |
| 32 #include "components/metrics/proto/omnibox_event.pb.h" | 32 #include "components/metrics/proto/omnibox_event.pb.h" |
| 33 #include "components/mime_util/mime_util.h" | 33 #include "components/mime_util/mime_util.h" |
| 34 #include "components/omnibox/browser/autocomplete_classifier.h" | 34 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 35 #include "components/omnibox/browser/autocomplete_match.h" | 35 #include "components/omnibox/browser/autocomplete_match.h" |
| 36 #include "components/prefs/pref_service.h" | 36 #include "components/prefs/pref_service.h" |
| 37 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
| 38 #include "content/public/browser/navigation_controller.h" |
| 39 #include "content/public/browser/navigation_entry.h" |
| 40 #include "content/public/browser/navigation_handle.h" |
| 38 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
| 39 #include "content/public/browser/plugin_service.h" | 42 #include "content/public/browser/plugin_service.h" |
| 40 #include "content/public/browser/user_metrics.h" | 43 #include "content/public/browser/user_metrics.h" |
| 41 #include "content/public/browser/web_contents.h" | 44 #include "content/public/browser/web_contents.h" |
| 42 #include "content/public/common/webplugininfo.h" | 45 #include "content/public/common/webplugininfo.h" |
| 43 #include "ipc/ipc_message.h" | 46 #include "ipc/ipc_message.h" |
| 44 #include "net/base/filename_util.h" | 47 #include "net/base/filename_util.h" |
| 45 #include "ui/base/models/list_selection_model.h" | 48 #include "ui/base/models/list_selection_model.h" |
| 46 #include "ui/gfx/image/image.h" | 49 #include "ui/gfx/image/image.h" |
| 47 #include "ui/views/controls/menu/menu_runner.h" | 50 #include "ui/views/controls/menu/menu_runner.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 data->title = contents->GetTitle(); | 502 data->title = contents->GetTitle(); |
| 500 data->url = contents->GetURL(); | 503 data->url = contents->GetURL(); |
| 501 data->loading = contents->IsLoading(); | 504 data->loading = contents->IsLoading(); |
| 502 data->crashed_status = contents->GetCrashedStatus(); | 505 data->crashed_status = contents->GetCrashedStatus(); |
| 503 data->incognito = contents->GetBrowserContext()->IsOffTheRecord(); | 506 data->incognito = contents->GetBrowserContext()->IsOffTheRecord(); |
| 504 data->pinned = model_->IsTabPinned(model_index); | 507 data->pinned = model_->IsTabPinned(model_index); |
| 505 data->show_icon = data->pinned || favicon::ShouldDisplayFavicon(contents); | 508 data->show_icon = data->pinned || favicon::ShouldDisplayFavicon(contents); |
| 506 data->blocked = model_->IsTabBlocked(model_index); | 509 data->blocked = model_->IsTabBlocked(model_index); |
| 507 data->app = extensions::TabHelper::FromWebContents(contents)->is_app(); | 510 data->app = extensions::TabHelper::FromWebContents(contents)->is_app(); |
| 508 data->alert_state = chrome::GetTabAlertStateForContents(contents); | 511 data->alert_state = chrome::GetTabAlertStateForContents(contents); |
| 512 |
| 513 content::NavigationEntry* entry = |
| 514 contents->GetController().GetLastCommittedEntry(); |
| 515 data->network_error = |
| 516 entry && (entry->GetPageType() == content::PAGE_TYPE_ERROR); |
| 509 } | 517 } |
| 510 | 518 |
| 511 void BrowserTabStripController::SetTabDataAt(content::WebContents* web_contents, | 519 void BrowserTabStripController::SetTabDataAt(content::WebContents* web_contents, |
| 512 int model_index) { | 520 int model_index) { |
| 513 TabRendererData data; | 521 TabRendererData data; |
| 514 SetTabRendererDataFromModel(web_contents, model_index, &data, EXISTING_TAB); | 522 SetTabRendererDataFromModel(web_contents, model_index, &data, EXISTING_TAB); |
| 515 tabstrip_->SetTabData(model_index, data); | 523 tabstrip_->SetTabData(model_index, data); |
| 516 } | 524 } |
| 517 | 525 |
| 518 void BrowserTabStripController::StartHighlightTabsForCommand( | 526 void BrowserTabStripController::StartHighlightTabsForCommand( |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 content::WebPluginInfo plugin; | 579 content::WebPluginInfo plugin; |
| 572 tabstrip_->FileSupported( | 580 tabstrip_->FileSupported( |
| 573 url, | 581 url, |
| 574 mime_type.empty() || mime_util::IsSupportedMimeType(mime_type) || | 582 mime_type.empty() || mime_util::IsSupportedMimeType(mime_type) || |
| 575 content::PluginService::GetInstance()->GetPluginInfo( | 583 content::PluginService::GetInstance()->GetPluginInfo( |
| 576 -1, // process ID | 584 -1, // process ID |
| 577 MSG_ROUTING_NONE, // routing ID | 585 MSG_ROUTING_NONE, // routing ID |
| 578 model_->profile()->GetResourceContext(), url, GURL(), mime_type, | 586 model_->profile()->GetResourceContext(), url, GURL(), mime_type, |
| 579 false, NULL, &plugin, NULL)); | 587 false, NULL, &plugin, NULL)); |
| 580 } | 588 } |
| OLD | NEW |