| 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/defaults.h" |
| 9 #include "chrome/browser/extensions/extension_tab_helper.h" | 10 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 10 #include "chrome/browser/favicon/favicon_tab_helper.h" | 11 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/tabs/tab_strip_model.h" | 13 #include "chrome/browser/tabs/tab_strip_model.h" |
| 13 #include "chrome/browser/tabs/tab_strip_selection_model.h" | 14 #include "chrome/browser/tabs/tab_strip_selection_model.h" |
| 14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_window.h" |
| 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 16 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 18 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
| 17 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" | 19 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" |
| 18 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" | 20 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" |
| 19 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
| 20 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 21 #include "content/browser/renderer_host/render_view_host.h" | 23 #include "content/browser/renderer_host/render_view_host.h" |
| 22 #include "content/browser/tab_contents/tab_contents.h" | 24 #include "content/browser/tab_contents/tab_contents.h" |
| 23 #include "content/browser/user_metrics.h" | 25 #include "content/browser/user_metrics.h" |
| 24 #include "content/common/notification_service.h" | 26 #include "content/common/notification_service.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 UserMetrics::RecordAction(UserMetricsAction("NewTab_Button")); | 312 UserMetrics::RecordAction(UserMetricsAction("NewTab_Button")); |
| 311 | 313 |
| 312 model_->delegate()->AddBlankTab(true); | 314 model_->delegate()->AddBlankTab(true); |
| 313 } | 315 } |
| 314 | 316 |
| 315 void BrowserTabStripController::ClickActiveTab(int index) { | 317 void BrowserTabStripController::ClickActiveTab(int index) { |
| 316 DCHECK(model_->active_index() == index); | 318 DCHECK(model_->active_index() == index); |
| 317 model_->ActiveTabClicked(index); | 319 model_->ActiveTabClicked(index); |
| 318 } | 320 } |
| 319 | 321 |
| 322 bool BrowserTabStripController::SizeTabButtonToTopOfTabStrip() { |
| 323 if (browser_defaults::kSizeTabButtonToTopOfTabStrip) |
| 324 return true; |
| 325 |
| 326 if (browser_ && browser_->window()) |
| 327 return browser_->window()->IsMaximized(); |
| 328 |
| 329 return false; |
| 330 } |
| 331 |
| 320 //////////////////////////////////////////////////////////////////////////////// | 332 //////////////////////////////////////////////////////////////////////////////// |
| 321 // BrowserTabStripController, TabStripModelObserver implementation: | 333 // BrowserTabStripController, TabStripModelObserver implementation: |
| 322 | 334 |
| 323 void BrowserTabStripController::TabInsertedAt(TabContentsWrapper* contents, | 335 void BrowserTabStripController::TabInsertedAt(TabContentsWrapper* contents, |
| 324 int model_index, | 336 int model_index, |
| 325 bool active) { | 337 bool active) { |
| 326 DCHECK(contents); | 338 DCHECK(contents); |
| 327 DCHECK(model_index == TabStripModel::kNoTab || | 339 DCHECK(model_index == TabStripModel::kNoTab || |
| 328 model_->ContainsIndex(model_index)); | 340 model_->ContainsIndex(model_index)); |
| 329 | 341 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 486 |
| 475 void BrowserTabStripController::StopHighlightTabsForCommand( | 487 void BrowserTabStripController::StopHighlightTabsForCommand( |
| 476 TabStripModel::ContextMenuCommand command_id, | 488 TabStripModel::ContextMenuCommand command_id, |
| 477 BaseTab* tab) { | 489 BaseTab* tab) { |
| 478 if (command_id == TabStripModel::CommandCloseTabsToRight || | 490 if (command_id == TabStripModel::CommandCloseTabsToRight || |
| 479 command_id == TabStripModel::CommandCloseOtherTabs) { | 491 command_id == TabStripModel::CommandCloseOtherTabs) { |
| 480 // Just tell all Tabs to stop pulsing - it's safe. | 492 // Just tell all Tabs to stop pulsing - it's safe. |
| 481 tabstrip_->StopAllHighlighting(); | 493 tabstrip_->StopAllHighlighting(); |
| 482 } | 494 } |
| 483 } | 495 } |
| OLD | NEW |