| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/tabs/browser_tab_strip_controller.h" | 5 #include "chrome/browser/views/tabs/browser_tab_strip_controller.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
| 10 #include "chrome/browser/metrics/user_metrics.h" | 10 #include "chrome/browser/metrics/user_metrics.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 bool BrowserTabStripController::IsCompatibleWith(BaseTabStrip* other) const { | 248 bool BrowserTabStripController::IsCompatibleWith(BaseTabStrip* other) const { |
| 249 Profile* other_profile = | 249 Profile* other_profile = |
| 250 static_cast<BrowserTabStripController*>(other->controller())->profile(); | 250 static_cast<BrowserTabStripController*>(other->controller())->profile(); |
| 251 return other_profile == profile(); | 251 return other_profile == profile(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void BrowserTabStripController::CreateNewTab() { | 254 void BrowserTabStripController::CreateNewTab() { |
| 255 // TODO(jcampan): if we decide to keep the app launcher as the default | |
| 256 // behavior for the new tab button, we should add a method | |
| 257 // on the TabStripDelegate to do so. | |
| 258 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsPanel)) { | |
| 259 NavigationController& controller = | |
| 260 model_->GetSelectedTabContents()->controller(); | |
| 261 AppLauncher::ShowForNewTab( | |
| 262 Browser::GetBrowserForController(&controller, NULL), std::string()); | |
| 263 return; | |
| 264 } | |
| 265 UserMetrics::RecordAction(UserMetricsAction("NewTab_Button"), | 255 UserMetrics::RecordAction(UserMetricsAction("NewTab_Button"), |
| 266 model_->profile()); | 256 model_->profile()); |
| 257 |
| 258 Browser* browser = model_->GetSelectedTabContents()->delegate()->GetBrowser(); |
| 259 if (browser->OpenAppsPanelAsNewTab()) |
| 260 return; |
| 261 |
| 267 model_->delegate()->AddBlankTab(true); | 262 model_->delegate()->AddBlankTab(true); |
| 268 } | 263 } |
| 269 | 264 |
| 270 //////////////////////////////////////////////////////////////////////////////// | 265 //////////////////////////////////////////////////////////////////////////////// |
| 271 // BrowserTabStripController, TabStripModelObserver implementation: | 266 // BrowserTabStripController, TabStripModelObserver implementation: |
| 272 | 267 |
| 273 void BrowserTabStripController::TabInsertedAt(TabContents* contents, | 268 void BrowserTabStripController::TabInsertedAt(TabContents* contents, |
| 274 int model_index, | 269 int model_index, |
| 275 bool foreground) { | 270 bool foreground) { |
| 276 DCHECK(contents); | 271 DCHECK(contents); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 void BrowserTabStripController::StopHighlightTabsForCommand( | 388 void BrowserTabStripController::StopHighlightTabsForCommand( |
| 394 TabStripModel::ContextMenuCommand command_id, | 389 TabStripModel::ContextMenuCommand command_id, |
| 395 BaseTabRenderer* tab) { | 390 BaseTabRenderer* tab) { |
| 396 if (command_id == TabStripModel::CommandCloseTabsOpenedBy || | 391 if (command_id == TabStripModel::CommandCloseTabsOpenedBy || |
| 397 command_id == TabStripModel::CommandCloseTabsToRight || | 392 command_id == TabStripModel::CommandCloseTabsToRight || |
| 398 command_id == TabStripModel::CommandCloseOtherTabs) { | 393 command_id == TabStripModel::CommandCloseOtherTabs) { |
| 399 // Just tell all Tabs to stop pulsing - it's safe. | 394 // Just tell all Tabs to stop pulsing - it's safe. |
| 400 tabstrip_->StopAllHighlighting(); | 395 tabstrip_->StopAllHighlighting(); |
| 401 } | 396 } |
| 402 } | 397 } |
| OLD | NEW |