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

Side by Side Diff: chrome/browser/views/frame/browser_view_layout.cc

Issue 1001003: Allow dynamic switching in and out of sidetabs mode. (Closed) Base URL: svn://svn.chromium.org/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/frame/browser_view_layout.h" 5 #include "chrome/browser/views/frame/browser_view_layout.h"
6 6
7 #include "app/gfx/scrollbar_size.h" 7 #include "app/gfx/scrollbar_size.h"
8 #include "chrome/browser/find_bar.h" 8 #include "chrome/browser/find_bar.h"
9 #include "chrome/browser/find_bar_controller.h" 9 #include "chrome/browser/find_bar_controller.h"
10 #include "chrome/browser/view_ids.h" 10 #include "chrome/browser/view_ids.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 int BrowserViewLayout::LayoutTabStrip() { 279 int BrowserViewLayout::LayoutTabStrip() {
280 if (!browser_view_->IsTabStripVisible()) { 280 if (!browser_view_->IsTabStripVisible()) {
281 tabstrip_->SetVisible(false); 281 tabstrip_->SetVisible(false);
282 tabstrip_->SetBounds(0, 0, 0, 0); 282 tabstrip_->SetBounds(0, 0, 0, 0);
283 return 0; 283 return 0;
284 } 284 }
285 gfx::Rect layout_bounds = 285 gfx::Rect layout_bounds =
286 browser_view_->frame()->GetBoundsForTabStrip(tabstrip_); 286 browser_view_->frame()->GetBoundsForTabStrip(tabstrip_);
287 287
288 if (browser_view_->UsingSideTabs()) { 288 if (browser_view_->UseVerticalTabs()) {
289 vertical_layout_rect_.Inset( 289 vertical_layout_rect_.Inset(
290 layout_bounds.right() - kBrowserViewTabStripHorizontalOverlap, 0, 0, 0); 290 layout_bounds.right() - kBrowserViewTabStripHorizontalOverlap, 0, 0, 0);
291 } else { 291 } else {
292 gfx::Rect toolbar_bounds = browser_view_->GetToolbarBounds(); 292 gfx::Rect toolbar_bounds = browser_view_->GetToolbarBounds();
293 tabstrip_->SetBackgroundOffset( 293 tabstrip_->SetBackgroundOffset(
294 gfx::Point(layout_bounds.x() - toolbar_bounds.x(), 294 gfx::Point(layout_bounds.x() - toolbar_bounds.x(),
295 layout_bounds.y())); 295 layout_bounds.y()));
296 } 296 }
297 297
298 gfx::Point tabstrip_origin = layout_bounds.origin(); 298 gfx::Point tabstrip_origin = layout_bounds.origin();
299 views::View::ConvertPointToView(browser_view_->GetParent(), browser_view_, 299 views::View::ConvertPointToView(browser_view_->GetParent(), browser_view_,
300 &tabstrip_origin); 300 &tabstrip_origin);
301 layout_bounds.set_origin(tabstrip_origin); 301 layout_bounds.set_origin(tabstrip_origin);
302 tabstrip_->SetVisible(true); 302 tabstrip_->SetVisible(true);
303 tabstrip_->SetBounds(layout_bounds); 303 tabstrip_->SetBounds(layout_bounds);
304 return browser_view_->UsingSideTabs() ? 0 : layout_bounds.bottom(); 304 return browser_view_->UseVerticalTabs() ? 0 : layout_bounds.bottom();
305 } 305 }
306 306
307 int BrowserViewLayout::LayoutToolbar(int top) { 307 int BrowserViewLayout::LayoutToolbar(int top) {
308 int browser_view_width = vertical_layout_rect_.width(); 308 int browser_view_width = vertical_layout_rect_.width();
309 bool visible = browser_view_->IsToolbarVisible(); 309 bool visible = browser_view_->IsToolbarVisible();
310 toolbar_->location_bar()->SetFocusable(visible); 310 toolbar_->location_bar()->SetFocusable(visible);
311 int y = 0; 311 int y = 0;
312 if (!browser_view_->UsingSideTabs()) { 312 if (!browser_view_->UseVerticalTabs()) {
313 y = top - 313 y = top -
314 ((visible && browser_view_->IsTabStripVisible()) 314 ((visible && browser_view_->IsTabStripVisible())
315 ? kToolbarTabStripVerticalOverlap : 0); 315 ? kToolbarTabStripVerticalOverlap : 0);
316 } 316 }
317 int height = visible ? toolbar_->GetPreferredSize().height() : 0; 317 int height = visible ? toolbar_->GetPreferredSize().height() : 0;
318 toolbar_->SetVisible(visible); 318 toolbar_->SetVisible(visible);
319 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height); 319 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height);
320 return y + height; 320 return y + height;
321 } 321 }
322 322
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 int height = 415 int height =
416 visible ? extension_shelf_->GetPreferredSize().height() : 0; 416 visible ? extension_shelf_->GetPreferredSize().height() : 0;
417 extension_shelf_->SetVisible(visible); 417 extension_shelf_->SetVisible(visible);
418 extension_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height, 418 extension_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height,
419 vertical_layout_rect_.width(), height); 419 vertical_layout_rect_.width(), height);
420 extension_shelf_->Layout(); 420 extension_shelf_->Layout();
421 bottom -= height; 421 bottom -= height;
422 } 422 }
423 return bottom; 423 return bottom;
424 } 424 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698