OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/gfx/point.h" | 7 #include "base/gfx/point.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/browser_about_handler.h" | 10 #include "chrome/browser/browser_about_handler.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/dom_ui/new_tab_ui.h" | |
13 #include "chrome/browser/profile.h" | 12 #include "chrome/browser/profile.h" |
14 #include "chrome/browser/navigation_controller.h" | 13 #include "chrome/browser/navigation_controller.h" |
15 #include "chrome/browser/navigation_entry.h" | 14 #include "chrome/browser/navigation_entry.h" |
16 #include "chrome/browser/render_view_host.h" | 15 #include "chrome/browser/render_view_host.h" |
17 #include "chrome/browser/tab_contents_factory.h" | 16 #include "chrome/browser/tab_contents_factory.h" |
18 #include "chrome/browser/tab_restore_service.h" | 17 #include "chrome/browser/tab_restore_service.h" |
19 #include "chrome/browser/tabs/tab_strip_model.h" | 18 #include "chrome/browser/tabs/tab_strip_model.h" |
20 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" | 19 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" |
21 #include "chrome/browser/user_metrics.h" | 20 #include "chrome/browser/user_metrics.h" |
22 #include "chrome/common/notification_service.h" | 21 #include "chrome/common/notification_service.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 326 |
328 bool TabStripModel::ShouldResetGroupOnSelect(TabContents* contents) const { | 327 bool TabStripModel::ShouldResetGroupOnSelect(TabContents* contents) const { |
329 int index = GetIndexOfTabContents(contents); | 328 int index = GetIndexOfTabContents(contents); |
330 DCHECK(ContainsIndex(index)); | 329 DCHECK(ContainsIndex(index)); |
331 return contents_data_.at(index)->reset_group_on_select; | 330 return contents_data_.at(index)->reset_group_on_select; |
332 } | 331 } |
333 | 332 |
334 TabContents* TabStripModel::AddBlankTab(bool foreground) { | 333 TabContents* TabStripModel::AddBlankTab(bool foreground) { |
335 DCHECK(delegate_); | 334 DCHECK(delegate_); |
336 TabContents* contents = delegate_->CreateTabContentsForURL( | 335 TabContents* contents = delegate_->CreateTabContentsForURL( |
337 NewTabUIURL(), GURL(), profile_, PageTransition::TYPED, false, NULL); | 336 delegate_->GetBlankTabURL(), GURL(), profile_, PageTransition::TYPED, |
| 337 false, NULL); |
338 AddTabContents(contents, -1, PageTransition::TYPED, foreground); | 338 AddTabContents(contents, -1, PageTransition::TYPED, foreground); |
339 return contents; | 339 return contents; |
340 } | 340 } |
341 | 341 |
342 TabContents* TabStripModel::AddBlankTabAt(int index, bool foreground) { | 342 TabContents* TabStripModel::AddBlankTabAt(int index, bool foreground) { |
343 DCHECK(delegate_); | 343 DCHECK(delegate_); |
344 TabContents* contents = delegate_->CreateTabContentsForURL( | 344 TabContents* contents = delegate_->CreateTabContentsForURL( |
345 NewTabUIURL(), GURL(), profile_, PageTransition::LINK, false, NULL); | 345 delegate_->GetBlankTabURL(), GURL(), profile_, PageTransition::LINK, |
| 346 false, NULL); |
346 AddTabContents(contents, index, PageTransition::LINK, foreground); | 347 AddTabContents(contents, index, PageTransition::LINK, foreground); |
347 return contents; | 348 return contents; |
348 } | 349 } |
349 | 350 |
350 void TabStripModel::AddTabContents(TabContents* contents, | 351 void TabStripModel::AddTabContents(TabContents* contents, |
351 int index, | 352 int index, |
352 PageTransition::Type transition, | 353 PageTransition::Type transition, |
353 bool foreground) { | 354 bool foreground) { |
354 if (transition == PageTransition::LINK) { | 355 if (transition == PageTransition::LINK) { |
355 // Only try to be clever if we're opening a LINK. | 356 // Only try to be clever if we're opening a LINK. |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 } | 606 } |
606 | 607 |
607 // static | 608 // static |
608 bool TabStripModel::OpenerMatches(TabContentsData* data, | 609 bool TabStripModel::OpenerMatches(TabContentsData* data, |
609 NavigationController* opener, | 610 NavigationController* opener, |
610 bool use_group) { | 611 bool use_group) { |
611 return data->opener == opener || (use_group && data->group == opener); | 612 return data->opener == opener || (use_group && data->group == opener); |
612 } | 613 } |
613 | 614 |
614 | 615 |
OLD | NEW |