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

Side by Side Diff: chrome/browser/views/tabs/side_tab_strip.cc

Issue 1141005: Revert r42156, r42157, r42160. Allow dynamic switching in and out of sidetabs... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 9 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) 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/side_tab_strip.h" 5 #include "chrome/browser/views/tabs/side_tab_strip.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/pref_service.h" 9 #include "chrome/browser/pref_service.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 20 matching lines...) Expand all
31 void SideTabStrip::SetModel(SideTabStripModel* model) { 31 void SideTabStrip::SetModel(SideTabStripModel* model) {
32 model_.reset(model); 32 model_.reset(model);
33 } 33 }
34 34
35 // static 35 // static
36 bool SideTabStrip::Available() { 36 bool SideTabStrip::Available() {
37 return CommandLine::ForCurrentProcess()->HasSwitch( 37 return CommandLine::ForCurrentProcess()->HasSwitch(
38 switches::kEnableVerticalTabs); 38 switches::kEnableVerticalTabs);
39 } 39 }
40 40
41 // static
42 bool SideTabStrip::Visible(Profile* profile) {
43 return Available() &&
44 profile->GetPrefs()->GetBoolean(prefs::kUseVerticalTabs);
45 }
46
41 void SideTabStrip::AddTabAt(int index) { 47 void SideTabStrip::AddTabAt(int index) {
42 SideTab* tab = new SideTab(this); 48 SideTab* tab = new SideTab(this);
43 AddChildView(tab); 49 AddChildView(tab);
44 Layout(); 50 Layout();
45 } 51 }
46 52
47 void SideTabStrip::RemoveTabAt(int index) { 53 void SideTabStrip::RemoveTabAt(int index) {
48 View* v = GetChildViewAt(index); 54 View* v = GetChildViewAt(index);
49 RemoveChildView(v); 55 RemoveChildView(v);
50 delete v; 56 delete v;
(...skipping 24 matching lines...) Expand all
75 } 81 }
76 82
77 void SideTabStrip::SelectTab(SideTab* tab) { 83 void SideTabStrip::SelectTab(SideTab* tab) {
78 model_->SelectTab(GetIndexOfSideTab(tab)); 84 model_->SelectTab(GetIndexOfSideTab(tab));
79 } 85 }
80 86
81 void SideTabStrip::CloseTab(SideTab* tab) { 87 void SideTabStrip::CloseTab(SideTab* tab) {
82 model_->CloseTab(GetIndexOfSideTab(tab)); 88 model_->CloseTab(GetIndexOfSideTab(tab));
83 } 89 }
84 90
85 void SideTabStrip::ShowContextMenu(SideTab* tab, const gfx::Point& p) {
86 model_->ShowContextMenu(GetIndexOfSideTab(tab), p);
87 }
88
89 //////////////////////////////////////////////////////////////////////////////// 91 ////////////////////////////////////////////////////////////////////////////////
90 // SideTabStrip, BaseTabStrip implementation: 92 // SideTabStrip, BaseTabStrip implementation:
91 93
92 int SideTabStrip::GetPreferredHeight() { 94 int SideTabStrip::GetPreferredHeight() {
93 return 0; 95 return 0;
94 } 96 }
95 97
96 void SideTabStrip::SetBackgroundOffset(const gfx::Point& offset) { 98 void SideTabStrip::SetBackgroundOffset(const gfx::Point& offset) {
97 } 99 }
98 100
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 //////////////////////////////////////////////////////////////////////////////// 146 ////////////////////////////////////////////////////////////////////////////////
145 // SideTabStrip, private: 147 // SideTabStrip, private:
146 148
147 int SideTabStrip::GetIndexOfSideTab(SideTab* tab) const { 149 int SideTabStrip::GetIndexOfSideTab(SideTab* tab) const {
148 return GetChildIndex(tab); 150 return GetChildIndex(tab);
149 } 151 }
150 152
151 SideTab* SideTabStrip::GetSideTabAt(int index) const { 153 SideTab* SideTabStrip::GetSideTabAt(int index) const {
152 return static_cast<SideTab*>(GetChildViewAt(index)); 154 return static_cast<SideTab*>(GetChildViewAt(index));
153 } 155 }
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/side_tab_strip.h ('k') | chrome/browser/views/tabs/side_tab_strip_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698