Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(880)

Side by Side Diff: chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc

Issue 6693054: Get rid of extensions dependency from content\browser. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/metrics/user_metrics.h" 10 #include "chrome/browser/metrics/user_metrics.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/tabs/tab_strip_model.h" 12 #include "chrome/browser/tabs/tab_strip_model.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
14 #include "chrome/browser/ui/tabs/tab_menu_model.h" 15 #include "chrome/browser/ui/tabs/tab_menu_model.h"
15 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" 16 #include "chrome/browser/ui/views/tabs/base_tab_strip.h"
16 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" 17 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h"
17 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
18 #include "content/browser/renderer_host/render_view_host.h" 19 #include "content/browser/renderer_host/render_view_host.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 TabRendererData data; 382 TabRendererData data;
382 SetTabRendererDataFromModel(contents->tab_contents(), model_index, &data); 383 SetTabRendererDataFromModel(contents->tab_contents(), model_index, &data);
383 tabstrip_->SetTabData(model_index, data); 384 tabstrip_->SetTabData(model_index, data);
384 } 385 }
385 386
386 void BrowserTabStripController::SetTabRendererDataFromModel( 387 void BrowserTabStripController::SetTabRendererDataFromModel(
387 TabContents* contents, 388 TabContents* contents,
388 int model_index, 389 int model_index,
389 TabRendererData* data) { 390 TabRendererData* data) {
390 SkBitmap* app_icon = NULL; 391 SkBitmap* app_icon = NULL;
392 TabContentsWrapper* wrapper =
393 TabContentsWrapper::GetCurrentWrapperForContents(contents);
391 394
392 // Extension App icons are slightly larger than favicons, so only allow 395 // Extension App icons are slightly larger than favicons, so only allow
393 // them if permitted by the model. 396 // them if permitted by the model.
394 if (model_->delegate()->LargeIconsPermitted()) 397 if (model_->delegate()->LargeIconsPermitted())
395 app_icon = contents->GetExtensionAppIcon(); 398 app_icon = wrapper->extension_tab_helper()->GetExtensionAppIcon();
396 399
397 if (app_icon) 400 if (app_icon)
398 data->favicon = *app_icon; 401 data->favicon = *app_icon;
399 else 402 else
400 data->favicon = contents->GetFavicon(); 403 data->favicon = contents->GetFavicon();
401 data->network_state = TabContentsNetworkState(contents); 404 data->network_state = TabContentsNetworkState(contents);
402 data->title = contents->GetTitle(); 405 data->title = contents->GetTitle();
403 data->loading = contents->is_loading(); 406 data->loading = contents->is_loading();
404 data->crashed_status = contents->crashed_status(); 407 data->crashed_status = contents->crashed_status();
405 data->incognito = contents->profile()->IsOffTheRecord(); 408 data->incognito = contents->profile()->IsOffTheRecord();
406 data->show_icon = contents->ShouldDisplayFavicon(); 409 data->show_icon = contents->ShouldDisplayFavicon();
407 data->mini = model_->IsMiniTab(model_index); 410 data->mini = model_->IsMiniTab(model_index);
408 data->blocked = model_->IsTabBlocked(model_index); 411 data->blocked = model_->IsTabBlocked(model_index);
409 data->app = contents->is_app(); 412 data->app = wrapper->extension_tab_helper()->is_app();
410 } 413 }
411 414
412 void BrowserTabStripController::StartHighlightTabsForCommand( 415 void BrowserTabStripController::StartHighlightTabsForCommand(
413 TabStripModel::ContextMenuCommand command_id, 416 TabStripModel::ContextMenuCommand command_id,
414 BaseTab* tab) { 417 BaseTab* tab) {
415 if (command_id == TabStripModel::CommandCloseOtherTabs || 418 if (command_id == TabStripModel::CommandCloseOtherTabs ||
416 command_id == TabStripModel::CommandCloseTabsToRight) { 419 command_id == TabStripModel::CommandCloseTabsToRight) {
417 int model_index = tabstrip_->GetModelIndexOfBaseTab(tab); 420 int model_index = tabstrip_->GetModelIndexOfBaseTab(tab);
418 if (IsValidIndex(model_index)) { 421 if (IsValidIndex(model_index)) {
419 std::vector<int> indices = 422 std::vector<int> indices =
(...skipping 24 matching lines...) Expand all
444 DCHECK(type.value == NotificationType::TAB_CLOSEABLE_STATE_CHANGED); 447 DCHECK(type.value == NotificationType::TAB_CLOSEABLE_STATE_CHANGED);
445 // Note that this notification may be fired during a model mutation and 448 // Note that this notification may be fired during a model mutation and
446 // possibly before the tabstrip has processed the change. 449 // possibly before the tabstrip has processed the change.
447 // Here, we just re-layout each existing tab to reflect the change in its 450 // Here, we just re-layout each existing tab to reflect the change in its
448 // closeable state, and then schedule paint for entire tabstrip. 451 // closeable state, and then schedule paint for entire tabstrip.
449 for (int i = 0; i < tabstrip_->tab_count(); ++i) { 452 for (int i = 0; i < tabstrip_->tab_count(); ++i) {
450 tabstrip_->base_tab_at_tab_index(i)->Layout(); 453 tabstrip_->base_tab_at_tab_index(i)->Layout();
451 } 454 }
452 tabstrip_->SchedulePaint(); 455 tabstrip_->SchedulePaint();
453 } 456 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698