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

Unified Diff: chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc

Issue 7065052: Improve large tab strip by leveraging touch icons when present (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied comments from sky Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index 1ae9b0f4adb6645577d946e7af47fae556e77b2e..76cd949d2a6dd84d408349186a526f89d3a00ad0 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -328,7 +328,8 @@ void BrowserTabStripController::TabInsertedAt(TabContentsWrapper* contents,
hover_tab_selector_.CancelTabTransition();
TabRendererData data;
- SetTabRendererDataFromModel(contents->tab_contents(), model_index, &data);
+ SetTabRendererDataFromModel(contents->tab_contents(), model_index, &data,
+ NEW_TAB);
tabstrip_->AddTabAt(model_index, data);
}
@@ -357,7 +358,8 @@ void BrowserTabStripController::TabMoved(TabContentsWrapper* contents,
// Update the data first as the pinned state may have changed.
TabRendererData data;
- SetTabRendererDataFromModel(contents->tab_contents(), to_model_index, &data);
+ SetTabRendererDataFromModel(contents->tab_contents(), to_model_index, &data,
+ EXISTING_TAB);
tabstrip_->SetTabData(from_model_index, data);
tabstrip_->MoveTab(from_model_index, to_model_index);
@@ -400,18 +402,27 @@ void BrowserTabStripController::TabBlockedStateChanged(
SetTabDataAt(contents, model_index);
}
-void BrowserTabStripController::SetTabDataAt(
- TabContentsWrapper* contents,
- int model_index) {
- TabRendererData data;
- SetTabRendererDataFromModel(contents->tab_contents(), model_index, &data);
- tabstrip_->SetTabData(model_index, data);
+////////////////////////////////////////////////////////////////////////////////
+// BrowserTabStripController, NotificationObserver implementation:
+
+void BrowserTabStripController::Observe(NotificationType type,
+ const NotificationSource& source, const NotificationDetails& details) {
+ DCHECK(type.value == NotificationType::TAB_CLOSEABLE_STATE_CHANGED);
+ // Note that this notification may be fired during a model mutation and
+ // possibly before the tabstrip has processed the change.
+ // Here, we just re-layout each existing tab to reflect the change in its
+ // closeable state, and then schedule paint for entire tabstrip.
+ for (int i = 0; i < tabstrip_->tab_count(); ++i) {
brettw 2011/06/17 16:20:49 No {} here.
Emmanuel Saint-loubert-Bié 2011/06/17 16:52:44 I did not write that code. I just moved it because
+ tabstrip_->base_tab_at_tab_index(i)->Layout();
+ }
+ tabstrip_->SchedulePaint();
}
void BrowserTabStripController::SetTabRendererDataFromModel(
TabContents* contents,
int model_index,
- TabRendererData* data) {
+ TabRendererData* data,
+ TabStatus tab_status) {
SkBitmap* app_icon = NULL;
TabContentsWrapper* wrapper =
TabContentsWrapper::GetCurrentWrapperForContents(contents);
@@ -437,6 +448,15 @@ void BrowserTabStripController::SetTabRendererDataFromModel(
data->app = wrapper->extension_tab_helper()->is_app();
}
+void BrowserTabStripController::SetTabDataAt(
+ TabContentsWrapper* contents,
+ int model_index) {
+ TabRendererData data;
+ SetTabRendererDataFromModel(contents->tab_contents(), model_index, &data,
+ EXISTING_TAB);
+ tabstrip_->SetTabData(model_index, data);
+}
+
void BrowserTabStripController::StartHighlightTabsForCommand(
TabStripModel::ContextMenuCommand command_id,
BaseTab* tab) {
@@ -464,18 +484,4 @@ void BrowserTabStripController::StopHighlightTabsForCommand(
}
}
-////////////////////////////////////////////////////////////////////////////////
-// BrowserTabStripController, NotificationObserver implementation:
-void BrowserTabStripController::Observe(NotificationType type,
- const NotificationSource& source, const NotificationDetails& details) {
- DCHECK(type.value == NotificationType::TAB_CLOSEABLE_STATE_CHANGED);
- // Note that this notification may be fired during a model mutation and
- // possibly before the tabstrip has processed the change.
- // Here, we just re-layout each existing tab to reflect the change in its
- // closeable state, and then schedule paint for entire tabstrip.
- for (int i = 0; i < tabstrip_->tab_count(); ++i) {
- tabstrip_->base_tab_at_tab_index(i)->Layout();
- }
- tabstrip_->SchedulePaint();
-}

Powered by Google App Engine
This is Rietveld 408576698