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

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

Issue 8253002: Move PageTransition into content namespace. While I'm touching all these files, I've also updated... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
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/tabs/tab_strip_model_order_controller.h" 5 #include "chrome/browser/tabs/tab_strip_model_order_controller.h"
6 6
7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
8 8
9 /////////////////////////////////////////////////////////////////////////////// 9 ///////////////////////////////////////////////////////////////////////////////
10 // TabStripModelOrderController, public: 10 // TabStripModelOrderController, public:
11 11
12 TabStripModelOrderController::TabStripModelOrderController( 12 TabStripModelOrderController::TabStripModelOrderController(
13 TabStripModel* tabstrip) 13 TabStripModel* tabstrip)
14 : tabstrip_(tabstrip), 14 : tabstrip_(tabstrip),
15 insertion_policy_(TabStripModel::INSERT_AFTER) { 15 insertion_policy_(TabStripModel::INSERT_AFTER) {
16 tabstrip_->AddObserver(this); 16 tabstrip_->AddObserver(this);
17 } 17 }
18 18
19 TabStripModelOrderController::~TabStripModelOrderController() { 19 TabStripModelOrderController::~TabStripModelOrderController() {
20 tabstrip_->RemoveObserver(this); 20 tabstrip_->RemoveObserver(this);
21 } 21 }
22 22
23 int TabStripModelOrderController::DetermineInsertionIndex( 23 int TabStripModelOrderController::DetermineInsertionIndex(
24 TabContentsWrapper* new_contents, 24 TabContentsWrapper* new_contents,
25 PageTransition::Type transition, 25 content::PageTransition transition,
26 bool foreground) { 26 bool foreground) {
27 int tab_count = tabstrip_->count(); 27 int tab_count = tabstrip_->count();
28 if (!tab_count) 28 if (!tab_count)
29 return 0; 29 return 0;
30 30
31 // NOTE: TabStripModel enforces that all non-mini-tabs occur after mini-tabs, 31 // NOTE: TabStripModel enforces that all non-mini-tabs occur after mini-tabs,
32 // so we don't have to check here too. 32 // so we don't have to check here too.
33 if (transition == PageTransition::LINK && tabstrip_->active_index() != -1) { 33 if (transition == content::PAGE_TRANSITION_LINK &&
34 tabstrip_->active_index() != -1) {
34 int delta = (insertion_policy_ == TabStripModel::INSERT_AFTER) ? 1 : 0; 35 int delta = (insertion_policy_ == TabStripModel::INSERT_AFTER) ? 1 : 0;
35 if (foreground) { 36 if (foreground) {
36 // If the page was opened in the foreground by a link click in another 37 // If the page was opened in the foreground by a link click in another
37 // tab, insert it adjacent to the tab that opened that link. 38 // tab, insert it adjacent to the tab that opened that link.
38 return tabstrip_->active_index() + delta; 39 return tabstrip_->active_index() + delta;
39 } 40 }
40 NavigationController* opener = 41 NavigationController* opener =
41 &tabstrip_->GetActiveTabContents()->controller(); 42 &tabstrip_->GetActiveTabContents()->controller();
42 // Get the index of the next item opened by this tab, and insert after 43 // Get the index of the next item opened by this tab, and insert after
43 // it... 44 // it...
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 138
138 /////////////////////////////////////////////////////////////////////////////// 139 ///////////////////////////////////////////////////////////////////////////////
139 // TabStripModelOrderController, private: 140 // TabStripModelOrderController, private:
140 141
141 int TabStripModelOrderController::GetValidIndex( 142 int TabStripModelOrderController::GetValidIndex(
142 int index, int removing_index) const { 143 int index, int removing_index) const {
143 if (removing_index < index) 144 if (removing_index < index)
144 index = std::max(0, index - 1); 145 index = std::max(0, index - 1);
145 return index; 146 return index;
146 } 147 }
OLDNEW
« no previous file with comments | « chrome/browser/tabs/tab_strip_model_order_controller.h ('k') | chrome/browser/tabs/tab_strip_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698