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

Side by Side Diff: chrome/browser/tabs/tab_strip_model.cc

Issue 125145: Implement the default tab opening behavior. Fix some linux build issues by adding missing includes. (Closed)
Patch Set: Missing include Created 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/views/tabs/tab_overview_controller.cc » ('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) 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 "chrome/browser/tabs/tab_strip_model.h" 5 #include "chrome/browser/tabs/tab_strip_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "build/build_config.h"
11 #include "chrome/browser/metrics/user_metrics.h" 12 #include "chrome/browser/metrics/user_metrics.h"
12 #include "chrome/browser/profile.h" 13 #include "chrome/browser/profile.h"
13 #include "chrome/browser/sessions/tab_restore_service.h" 14 #include "chrome/browser/sessions/tab_restore_service.h"
14 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" 15 #include "chrome/browser/tabs/tab_strip_model_order_controller.h"
15 #include "chrome/browser/tab_contents/navigation_controller.h" 16 #include "chrome/browser/tab_contents/navigation_controller.h"
16 #include "chrome/browser/tab_contents/tab_contents.h" 17 #include "chrome/browser/tab_contents/tab_contents.h"
17 #include "chrome/common/notification_service.h" 18 #include "chrome/common/notification_service.h"
18 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
19 20
20 namespace { 21 namespace {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 int index, 335 int index,
335 bool force_index, 336 bool force_index,
336 PageTransition::Type transition, 337 PageTransition::Type transition,
337 bool foreground) { 338 bool foreground) {
338 if (transition == PageTransition::LINK && !force_index) { 339 if (transition == PageTransition::LINK && !force_index) {
339 // Only try to be clever if we're opening a LINK. 340 // Only try to be clever if we're opening a LINK.
340 index = order_controller_->DetermineInsertionIndex( 341 index = order_controller_->DetermineInsertionIndex(
341 contents, transition, foreground); 342 contents, transition, foreground);
342 } else { 343 } else {
343 // For all other types, respect what was passed to us, normalizing -1s. 344 // For all other types, respect what was passed to us, normalizing -1s.
345 #if defined(LINUX2)
346 index = 0;
347 #else
344 if (index < 0) 348 if (index < 0)
345 index = count(); 349 index = count();
350 #endif
346 } 351 }
347 352
348 // Tabs opened from links inherit the "group" attribute of the Tab from which 353 // Tabs opened from links inherit the "group" attribute of the Tab from which
349 // they were opened. This means when they're closed, that Tab will be 354 // they were opened. This means when they're closed, that Tab will be
350 // selected again. 355 // selected again.
351 bool inherit_group = transition == PageTransition::LINK; 356 bool inherit_group = transition == PageTransition::LINK;
352 if (!inherit_group) { 357 if (!inherit_group) {
353 // Also, any tab opened at the end of the TabStrip with a "TYPED" 358 // Also, any tab opened at the end of the TabStrip with a "TYPED"
354 // transition inherit group as well. This covers the cases where the user 359 // transition inherit group as well. This covers the cases where the user
355 // creates a New Tab (e.g. Ctrl+T, or clicks the New Tab button), or types 360 // creates a New Tab (e.g. Ctrl+T, or clicks the New Tab button), or types
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 int index = GetIndexOfTabContents(contents); 584 int index = GetIndexOfTabContents(contents);
580 contents_data_.at(index)->opener = &opener->controller(); 585 contents_data_.at(index)->opener = &opener->controller();
581 } 586 }
582 587
583 // static 588 // static
584 bool TabStripModel::OpenerMatches(const TabContentsData* data, 589 bool TabStripModel::OpenerMatches(const TabContentsData* data,
585 const NavigationController* opener, 590 const NavigationController* opener,
586 bool use_group) { 591 bool use_group) {
587 return data->opener == opener || (use_group && data->group == opener); 592 return data->opener == opener || (use_group && data->group == opener);
588 } 593 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/views/tabs/tab_overview_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698