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

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

Issue 6913026: Compact Navigation prototype (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added missing DropdownBarHostDelegate header file. Created 9 years, 7 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/ui/views/frame/browser_view_layout.h" 5 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
6 6
7 #include "chrome/browser/sidebar/sidebar_manager.h" 7 #include "chrome/browser/sidebar/sidebar_manager.h"
8 #include "chrome/browser/ui/find_bar/find_bar.h" 8 #include "chrome/browser/ui/find_bar/find_bar.h"
9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
10 #include "chrome/browser/ui/view_ids.h" 10 #include "chrome/browser/ui/view_ids.h"
(...skipping 16 matching lines...) Expand all
27 #include "views/window/hit_test.h" 27 #include "views/window/hit_test.h"
28 #endif 28 #endif
29 29
30 namespace { 30 namespace {
31 31
32 // The visible height of the shadow above the tabs. Clicks in this area are 32 // The visible height of the shadow above the tabs. Clicks in this area are
33 // treated as clicks to the frame, rather than clicks to the tab. 33 // treated as clicks to the frame, rather than clicks to the tab.
34 const int kTabShadowSize = 2; 34 const int kTabShadowSize = 2;
35 // The vertical overlap between the TabStrip and the Toolbar. 35 // The vertical overlap between the TabStrip and the Toolbar.
36 const int kToolbarTabStripVerticalOverlap = 3; 36 const int kToolbarTabStripVerticalOverlap = 3;
37 // The vertical size of the space between the content area and the tabstrip that
38 // is inserted in compact navigation mode. Note that we need to use a height
39 // that includes the overlap to get the visible height we want, in order to
40 // match how the toolbar overlaps the tabstrip.
41 const int kCompactNavbarSpacerVisibleHeight = 4;
42 const int kCompactNavbarSpacerHeight =
43 kCompactNavbarSpacerVisibleHeight + kToolbarTabStripVerticalOverlap;
44 // The size of the padding between the compact navigation bar and the tab strip.
45 const int kCompactNavbarHorizontalPadding = 2;
46 // The number of pixels the bookmark bar should overlap the spacer by if the
47 // spacer is visible.
48 const int kSpacerBookmarkBarOverlap = 1;
49
50 // Combines View::ConvertPointToView and View::HitTest for a given |point|.
51 // Converts |point| from |src| to |dst| and hit tests it against |dst|. The
52 // converted |point| can then be retrieved and used for additional tests.
53 bool ConvertedHitTest(views::View* src, views::View* dst, gfx::Point* point) {
54 DCHECK(src);
55 DCHECK(dst);
56 DCHECK(point);
57 views::View::ConvertPointToView(src, dst, point);
58 return dst->HitTest(*point);
59 }
37 60
38 } // namespace 61 } // namespace
39 62
40 //////////////////////////////////////////////////////////////////////////////// 63 ////////////////////////////////////////////////////////////////////////////////
41 // BrowserViewLayout, public: 64 // BrowserViewLayout, public:
42 65
43 BrowserViewLayout::BrowserViewLayout() 66 BrowserViewLayout::BrowserViewLayout()
44 : tabstrip_(NULL), 67 : tabstrip_(NULL),
45 toolbar_(NULL), 68 toolbar_(NULL),
46 contents_split_(NULL), 69 contents_split_(NULL),
47 contents_container_(NULL), 70 contents_container_(NULL),
48 infobar_container_(NULL), 71 infobar_container_(NULL),
49 download_shelf_(NULL), 72 download_shelf_(NULL),
50 active_bookmark_bar_(NULL), 73 active_bookmark_bar_(NULL),
sky 2011/05/09 14:27:22 Add initializers for new fields.
SteveT 2011/05/09 19:40:04 Done.
51 browser_view_(NULL), 74 browser_view_(NULL),
52 find_bar_y_(0) { 75 find_bar_y_(0) {
53 } 76 }
54 77
55 BrowserViewLayout::~BrowserViewLayout() { 78 BrowserViewLayout::~BrowserViewLayout() {
56 } 79 }
57 80
58 gfx::Size BrowserViewLayout::GetMinimumSize() { 81 gfx::Size BrowserViewLayout::GetMinimumSize() {
59 // TODO(noname): In theory the tabstrip width should probably be 82 // TODO(noname): In theory the tabstrip width should probably be
60 // (OTR + tabstrip + caption buttons) width. 83 // (OTR + tabstrip + caption buttons) width.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Since the TabStrip only renders in some parts of the top of the window, 154 // Since the TabStrip only renders in some parts of the top of the window,
132 // the un-obscured area is considered to be part of the non-client caption 155 // the un-obscured area is considered to be part of the non-client caption
133 // area of the window. So we need to treat hit-tests in these regions as 156 // area of the window. So we need to treat hit-tests in these regions as
134 // hit-tests of the titlebar. 157 // hit-tests of the titlebar.
135 158
136 views::View* parent = browser_view_->parent(); 159 views::View* parent = browser_view_->parent();
137 160
138 gfx::Point point_in_browser_view_coords(point); 161 gfx::Point point_in_browser_view_coords(point);
139 views::View::ConvertPointToView( 162 views::View::ConvertPointToView(
140 parent, browser_view_, &point_in_browser_view_coords); 163 parent, browser_view_, &point_in_browser_view_coords);
164 gfx::Point test_point(point);
141 165
142 // Determine if the TabStrip exists and is capable of being clicked on. We 166 // Determine if the TabStrip exists and is capable of being clicked on. We
143 // might be a popup window without a TabStrip. 167 // might be a popup window without a TabStrip.
144 if (browser_view_->IsTabStripVisible()) { 168 if (browser_view_->IsTabStripVisible()) {
145 // See if the mouse pointer is within the bounds of the TabStrip. 169 // See if the mouse pointer is within the bounds of the TabStrip.
146 gfx::Point point_in_tabstrip_coords(point); 170 if (ConvertedHitTest(parent, tabstrip_, &test_point)) {
147 views::View::ConvertPointToView(parent, tabstrip_, 171 if (tabstrip_->IsPositionInWindowCaption(test_point))
148 &point_in_tabstrip_coords);
149 if (tabstrip_->HitTest(point_in_tabstrip_coords)) {
150 if (tabstrip_->IsPositionInWindowCaption(point_in_tabstrip_coords))
151 return HTCAPTION; 172 return HTCAPTION;
152 return HTCLIENT; 173 return HTCLIENT;
153 } 174 }
154 175
176 // If the tabstrip is visible and we are in compact navigation mode, test
177 // against the compact navigation and option bars.
178 if (browser_view_->UseCompactNavigationBar()) {
179 test_point = point;
180 if (ConvertedHitTest(parent, compact_navigation_bar_, &test_point))
181 return HTCLIENT;
182 test_point = point;
183 if (ConvertedHitTest(parent, compact_options_bar_, &test_point))
184 return HTCLIENT;
185 }
186
155 // The top few pixels of the TabStrip are a drop-shadow - as we're pretty 187 // The top few pixels of the TabStrip are a drop-shadow - as we're pretty
156 // starved of dragable area, let's give it to window dragging (this also 188 // starved of dragable area, let's give it to window dragging (this also
157 // makes sense visually). 189 // makes sense visually).
158 if (!browser_view_->IsMaximized() && 190 if (!browser_view_->IsMaximized() &&
159 (point_in_browser_view_coords.y() < 191 (point_in_browser_view_coords.y() <
160 (tabstrip_->y() + kTabShadowSize))) { 192 (tabstrip_->y() + kTabShadowSize))) {
161 // We return HTNOWHERE as this is a signal to our containing 193 // We return HTNOWHERE as this is a signal to our containing
162 // NonClientView that it should figure out what the correct hit-test 194 // NonClientView that it should figure out what the correct hit-test
163 // code is given the mouse position... 195 // code is given the mouse position...
164 return HTNOWHERE; 196 return HTNOWHERE;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // BrowserViewLayout, views::LayoutManager implementation: 229 // BrowserViewLayout, views::LayoutManager implementation:
198 230
199 void BrowserViewLayout::Installed(views::View* host) { 231 void BrowserViewLayout::Installed(views::View* host) {
200 toolbar_ = NULL; 232 toolbar_ = NULL;
201 contents_split_ = NULL; 233 contents_split_ = NULL;
202 contents_container_ = NULL; 234 contents_container_ = NULL;
203 infobar_container_ = NULL; 235 infobar_container_ = NULL;
204 download_shelf_ = NULL; 236 download_shelf_ = NULL;
205 active_bookmark_bar_ = NULL; 237 active_bookmark_bar_ = NULL;
206 tabstrip_ = NULL; 238 tabstrip_ = NULL;
239 compact_navigation_bar_ = NULL;
240 compact_options_bar_ = NULL;
241 spacer_ = NULL;
207 browser_view_ = static_cast<BrowserView*>(host); 242 browser_view_ = static_cast<BrowserView*>(host);
208 } 243 }
209 244
210 void BrowserViewLayout::Uninstalled(views::View* host) {} 245 void BrowserViewLayout::Uninstalled(views::View* host) {}
211 246
212 void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) { 247 void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) {
213 switch (view->GetID()) { 248 switch (view->GetID()) {
214 case VIEW_ID_CONTENTS_SPLIT: { 249 case VIEW_ID_CONTENTS_SPLIT: {
215 contents_split_ = static_cast<views::SingleSplitView*>(view); 250 contents_split_ = static_cast<views::SingleSplitView*>(view);
216 // We're installed as the LayoutManager before BrowserView creates the 251 // We're installed as the LayoutManager before BrowserView creates the
(...skipping 10 matching lines...) Expand all
227 break; 262 break;
228 case VIEW_ID_BOOKMARK_BAR: 263 case VIEW_ID_BOOKMARK_BAR:
229 active_bookmark_bar_ = static_cast<BookmarkBarView*>(view); 264 active_bookmark_bar_ = static_cast<BookmarkBarView*>(view);
230 break; 265 break;
231 case VIEW_ID_TOOLBAR: 266 case VIEW_ID_TOOLBAR:
232 toolbar_ = static_cast<ToolbarView*>(view); 267 toolbar_ = static_cast<ToolbarView*>(view);
233 break; 268 break;
234 case VIEW_ID_TAB_STRIP: 269 case VIEW_ID_TAB_STRIP:
235 tabstrip_ = static_cast<AbstractTabStripView*>(view); 270 tabstrip_ = static_cast<AbstractTabStripView*>(view);
236 break; 271 break;
272 case VIEW_ID_COMPACT_NAV_BAR_SPACER:
273 spacer_ = view;
274 break;
275 case VIEW_ID_COMPACT_NAV_BAR:
276 compact_navigation_bar_ = view;
277 break;
278 case VIEW_ID_COMPACT_OPT_BAR:
279 compact_options_bar_ = view;
280 break;
237 } 281 }
238 } 282 }
239 283
240 void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) { 284 void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) {
241 switch (view->GetID()) { 285 switch (view->GetID()) {
242 case VIEW_ID_BOOKMARK_BAR: 286 case VIEW_ID_BOOKMARK_BAR:
243 active_bookmark_bar_ = NULL; 287 active_bookmark_bar_ = NULL;
244 break; 288 break;
245 } 289 }
246 } 290 }
247 291
248 void BrowserViewLayout::Layout(views::View* host) { 292 void BrowserViewLayout::Layout(views::View* host) {
249 vertical_layout_rect_ = browser_view_->GetLocalBounds(); 293 vertical_layout_rect_ = browser_view_->GetLocalBounds();
250 int top = LayoutTabStrip(); 294 int top = LayoutTabStripRegion();
251 if (browser_view_->IsTabStripVisible() && !browser_view_->UseVerticalTabs()) { 295 if (browser_view_->IsTabStripVisible() && !browser_view_->UseVerticalTabs()) {
252 tabstrip_->SetBackgroundOffset(gfx::Point( 296 tabstrip_->SetBackgroundOffset(gfx::Point(
253 tabstrip_->GetMirroredX() + browser_view_->GetMirroredX(), 297 tabstrip_->GetMirroredX() + browser_view_->GetMirroredX(),
254 browser_view_->frame()->GetHorizontalTabStripVerticalOffset(false))); 298 browser_view_->frame()->GetHorizontalTabStripVerticalOffset(false)));
255 } 299 }
256 top = LayoutToolbar(top); 300 top = LayoutToolbar(top);
257 top = LayoutBookmarkAndInfoBars(top); 301 top = LayoutBookmarkAndInfoBars(top);
258 int bottom = LayoutDownloadShelf(browser_view_->height()); 302 int bottom = LayoutDownloadShelf(browser_view_->height());
259 int active_top_margin = GetTopMarginForActiveContent(); 303 int active_top_margin = GetTopMarginForActiveContent();
260 top -= active_top_margin; 304 top -= active_top_margin;
261 contents_container_->SetActiveTopMargin(active_top_margin); 305 contents_container_->SetActiveTopMargin(active_top_margin);
262 LayoutTabContents(top, bottom); 306 LayoutTabContents(top, bottom);
263 // This must be done _after_ we lay out the TabContents since this 307 // This must be done _after_ we lay out the TabContents since this
264 // code calls back into us to find the bounding box the find bar 308 // code calls back into us to find the bounding box the find bar
265 // must be laid out within, and that code depends on the 309 // must be laid out within, and that code depends on the
266 // TabContentsContainer's bounds being up to date. 310 // TabContentsContainer's bounds being up to date.
267 if (browser()->HasFindBarController()) { 311 if (browser()->HasFindBarController()) {
268 browser()->GetFindBarController()->find_bar()->MoveWindowIfNecessary( 312 browser()->GetFindBarController()->find_bar()->MoveWindowIfNecessary(
269 gfx::Rect(), true); 313 gfx::Rect(), true);
270 } 314 }
315 if (browser()->UseCompactNavigationBar()) {
316 DCHECK(browser_view_->compact_location_bar_view_host());
317 browser_view_->compact_location_bar_view_host()->MoveWindowIfNecessary(
318 gfx::Rect(), true);
319 }
271 } 320 }
272 321
273 // Return the preferred size which is the size required to give each 322 // Return the preferred size which is the size required to give each
274 // children their respective preferred size. 323 // children their respective preferred size.
275 gfx::Size BrowserViewLayout::GetPreferredSize(views::View* host) { 324 gfx::Size BrowserViewLayout::GetPreferredSize(views::View* host) {
276 return gfx::Size(); 325 return gfx::Size();
277 } 326 }
278 327
279 ////////////////////////////////////////////////////////////////////////////// 328 //////////////////////////////////////////////////////////////////////////////
280 // BrowserViewLayout, private: 329 // BrowserViewLayout, private:
281 330
282 Browser* BrowserViewLayout::browser() { 331 Browser* BrowserViewLayout::browser() {
283 return browser_view_->browser(); 332 return browser_view_->browser();
284 } 333 }
285 334
286 const Browser* BrowserViewLayout::browser() const { 335 const Browser* BrowserViewLayout::browser() const {
287 return browser_view_->browser(); 336 return browser_view_->browser();
288 } 337 }
289 338
290 int BrowserViewLayout::LayoutTabStrip() { 339 int BrowserViewLayout::LayoutTabStripRegion() {
291 if (!browser_view_->IsTabStripVisible()) { 340 if (!browser_view_->IsTabStripVisible()) {
341 if (compact_navigation_bar_ && compact_options_bar_) {
342 compact_navigation_bar_->SetVisible(false);
343 compact_options_bar_->SetVisible(false);
344 }
292 tabstrip_->SetVisible(false); 345 tabstrip_->SetVisible(false);
293 tabstrip_->SetBounds(0, 0, 0, 0); 346 tabstrip_->SetBounds(0, 0, 0, 0);
294 return 0; 347 return 0;
295 } 348 }
296 349
350 // This retrieves the bounds for the tab strip based on whether or not we show
351 // anything to the left of it, like the incognito avatar.
297 gfx::Rect tabstrip_bounds( 352 gfx::Rect tabstrip_bounds(
298 browser_view_->frame()->GetBoundsForTabStrip(tabstrip_)); 353 browser_view_->frame()->GetBoundsForTabStrip(tabstrip_));
299 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); 354 gfx::Point tabstrip_origin(tabstrip_bounds.origin());
300 views::View::ConvertPointToView(browser_view_->parent(), browser_view_, 355 views::View::ConvertPointToView(browser_view_->parent(), browser_view_,
301 &tabstrip_origin); 356 &tabstrip_origin);
302 tabstrip_bounds.set_origin(tabstrip_origin); 357 tabstrip_bounds.set_origin(tabstrip_origin);
303 358
359 // If we are in compact nav mode, we want to reduce the tab strip bounds from
360 // both ends enough to lay out the compact navigation and options bars. We
361 // check the pref itself (in browser) rather than the current state since it
362 // determines if the classes have been instantiated. We use the
363 if (browser_view_->browser()->UseCompactNavigationBar()) {
364 compact_navigation_bar_->SetVisible(
365 browser_view_->UseCompactNavigationBar());
366 compact_options_bar_->SetVisible(browser_view_->UseCompactNavigationBar());
367
368 if (compact_navigation_bar_->IsVisible()) {
369 gfx::Rect cnav_bar_bounds;
370 gfx::Size cnav_bar_size = compact_navigation_bar_->GetPreferredSize();
371 cnav_bar_bounds.set_origin(tabstrip_bounds.origin());
372 cnav_bar_bounds.set_size(cnav_bar_size);
373 compact_navigation_bar_->SetBoundsRect(cnav_bar_bounds);
374
375 // The options bar is flush right of the tab strip region.
376 gfx::Rect copt_bar_bounds;
377 gfx::Size copt_bar_size = compact_options_bar_->GetPreferredSize();
378 copt_bar_bounds.set_x(std::max(0, tabstrip_bounds.right() -
379 copt_bar_size.width()));
380 copt_bar_bounds.set_y(tabstrip_origin.y());
381 copt_bar_bounds.set_size(copt_bar_size);
382 compact_options_bar_->SetBoundsRect(copt_bar_bounds);
383
384 // Reduce the bounds of the tab strip accordingly.
385 tabstrip_bounds.set_x(tabstrip_bounds.x() + cnav_bar_size.width() +
386 kCompactNavbarHorizontalPadding);
387 tabstrip_bounds.set_width(std::max(0, tabstrip_bounds.width() -
388 cnav_bar_size.width() - copt_bar_size.width() -
389 kCompactNavbarHorizontalPadding * 2));
390 }
391 }
392
304 if (browser_view_->UseVerticalTabs()) 393 if (browser_view_->UseVerticalTabs())
305 vertical_layout_rect_.Inset(tabstrip_bounds.width(), 0, 0, 0); 394 vertical_layout_rect_.Inset(tabstrip_bounds.width(), 0, 0, 0);
306 395
307 tabstrip_->SetVisible(true); 396 tabstrip_->SetVisible(true);
308 tabstrip_->SetBoundsRect(tabstrip_bounds); 397 tabstrip_->SetBoundsRect(tabstrip_bounds);
309 return browser_view_->UseVerticalTabs() ? 398 return browser_view_->UseVerticalTabs() ?
310 tabstrip_bounds.y() : tabstrip_bounds.bottom(); 399 tabstrip_bounds.y() : tabstrip_bounds.bottom();
311 } 400 }
312 401
313 int BrowserViewLayout::LayoutToolbar(int top) { 402 int BrowserViewLayout::LayoutToolbar(int top) {
314 int browser_view_width = vertical_layout_rect_.width(); 403 int browser_view_width = vertical_layout_rect_.width();
315 bool visible = browser_view_->IsToolbarVisible(); 404 bool toolbar_visible = browser_view_->IsToolbarVisible();
316 toolbar_->location_bar()->SetFocusable(visible); 405 toolbar_->location_bar()->SetFocusable(toolbar_visible);
317 int y = top; 406 int y = top;
318 if (!browser_view_->UseVerticalTabs()) { 407 if (!browser_view_->UseVerticalTabs()) {
319 y -= ((visible && browser_view_->IsTabStripVisible()) ? 408 y -= ((toolbar_visible || browser_view_->UseCompactNavigationBar()) &&
320 kToolbarTabStripVerticalOverlap : 0); 409 browser_view_->IsTabStripVisible()) ?
410 kToolbarTabStripVerticalOverlap : 0;
321 } 411 }
322 int height = visible ? toolbar_->GetPreferredSize().height() : 0; 412 int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
323 toolbar_->SetVisible(visible); 413 toolbar_->SetVisible(toolbar_visible);
324 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height); 414 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height);
415
416 // The spacer essentially replaces the toolbar when in compact mode.
417 if (browser_view_->UseCompactNavigationBar()) {
418 spacer_->SetVisible(!toolbar_visible);
419 spacer_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width,
420 toolbar_visible ? 0 : kCompactNavbarSpacerHeight);
421 height = kCompactNavbarSpacerHeight;
422 }
423
325 return y + height; 424 return y + height;
326 } 425 }
327 426
328 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top) { 427 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top) {
329 find_bar_y_ = top + browser_view_->y() - 1; 428 find_bar_y_ = top + browser_view_->y() - 1;
330 if (active_bookmark_bar_) { 429 if (active_bookmark_bar_) {
331 // If we're showing the Bookmark bar in detached style, then we 430 // If we're showing the Bookmark bar in detached style, then we
332 // need to show any Info bar _above_ the Bookmark bar, since the 431 // need to show any Info bar _above_ the Bookmark bar, since the
333 // Bookmark bar is styled to look like it's part of the page. 432 // Bookmark bar is styled to look like it's part of the page.
334 if (active_bookmark_bar_->IsDetached()) 433 if (active_bookmark_bar_->IsDetached())
335 return LayoutBookmarkBar(LayoutInfoBar(top)); 434 return LayoutBookmarkBar(LayoutInfoBar(top));
336 // Otherwise, Bookmark bar first, Info bar second. 435 // Otherwise, Bookmark bar first, Info bar second.
337 top = std::max(toolbar_->bounds().bottom(), LayoutBookmarkBar(top)); 436 top = std::max(toolbar_->bounds().bottom(), LayoutBookmarkBar(top));
338 } 437 }
339 find_bar_y_ = top + browser_view_->y() - 1; 438 find_bar_y_ = top + browser_view_->y() - 1;
340 return LayoutInfoBar(top); 439 return LayoutInfoBar(top);
341 } 440 }
342 441
343 int BrowserViewLayout::LayoutBookmarkBar(int top) { 442 int BrowserViewLayout::LayoutBookmarkBar(int top) {
344 DCHECK(active_bookmark_bar_); 443 DCHECK(active_bookmark_bar_);
345 int y = top; 444 int y = top;
346 if (!browser_view_->IsBookmarkBarVisible()) { 445 if (!browser_view_->IsBookmarkBarVisible()) {
347 active_bookmark_bar_->SetVisible(false); 446 active_bookmark_bar_->SetVisible(false);
348 active_bookmark_bar_->SetBounds(0, y, browser_view_->width(), 0); 447 active_bookmark_bar_->SetBounds(0, y, browser_view_->width(), 0);
349 return y; 448 return y;
350 } 449 }
351 450
352 active_bookmark_bar_->set_infobar_visible(InfobarVisible()); 451 active_bookmark_bar_->set_infobar_visible(InfobarVisible());
353 int bookmark_bar_height = active_bookmark_bar_->GetPreferredSize().height(); 452 int bookmark_bar_height = active_bookmark_bar_->GetPreferredSize().height();
354 y -= views::NonClientFrameView::kClientEdgeThickness + 453 if (!browser_view_->UseCompactNavigationBar()) {
355 active_bookmark_bar_->GetToolbarOverlap(false); 454 y -= views::NonClientFrameView::kClientEdgeThickness +
455 active_bookmark_bar_->GetToolbarOverlap(false);
456 } else {
457 y -= kSpacerBookmarkBarOverlap;
458 }
356 active_bookmark_bar_->SetVisible(true); 459 active_bookmark_bar_->SetVisible(true);
357 active_bookmark_bar_->SetBounds(vertical_layout_rect_.x(), y, 460 active_bookmark_bar_->SetBounds(vertical_layout_rect_.x(), y,
358 vertical_layout_rect_.width(), 461 vertical_layout_rect_.width(),
359 bookmark_bar_height); 462 bookmark_bar_height);
360 return y + bookmark_bar_height; 463 return y + bookmark_bar_height;
361 } 464 }
362 465
363 int BrowserViewLayout::LayoutInfoBar(int top) { 466 int BrowserViewLayout::LayoutInfoBar(int top) {
364 // Raise the |infobar_container_| by its vertical overlap. 467 // Raise the |infobar_container_| by its vertical overlap.
365 infobar_container_->SetVisible(InfobarVisible()); 468 infobar_container_->SetVisible(InfobarVisible());
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 bottom -= height; 623 bottom -= height;
521 } 624 }
522 return bottom; 625 return bottom;
523 } 626 }
524 627
525 bool BrowserViewLayout::InfobarVisible() const { 628 bool BrowserViewLayout::InfobarVisible() const {
526 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 629 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
527 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 630 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
528 (infobar_container_->GetPreferredSize().height() != 0); 631 (infobar_container_->GetPreferredSize().height() != 0);
529 } 632 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698