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

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: Clang build fix. After commit/revert. 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),
72 compact_navigation_bar_(NULL),
73 compact_options_bar_(NULL),
74 compact_spacer_(NULL),
49 download_shelf_(NULL), 75 download_shelf_(NULL),
50 active_bookmark_bar_(NULL), 76 active_bookmark_bar_(NULL),
51 browser_view_(NULL), 77 browser_view_(NULL),
52 find_bar_y_(0) { 78 find_bar_y_(0) {
53 } 79 }
54 80
55 BrowserViewLayout::~BrowserViewLayout() { 81 BrowserViewLayout::~BrowserViewLayout() {
56 } 82 }
57 83
58 gfx::Size BrowserViewLayout::GetMinimumSize() { 84 gfx::Size BrowserViewLayout::GetMinimumSize() {
(...skipping 72 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, 157 // 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 158 // 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 159 // area of the window. So we need to treat hit-tests in these regions as
134 // hit-tests of the titlebar. 160 // hit-tests of the titlebar.
135 161
136 views::View* parent = browser_view_->parent(); 162 views::View* parent = browser_view_->parent();
137 163
138 gfx::Point point_in_browser_view_coords(point); 164 gfx::Point point_in_browser_view_coords(point);
139 views::View::ConvertPointToView( 165 views::View::ConvertPointToView(
140 parent, browser_view_, &point_in_browser_view_coords); 166 parent, browser_view_, &point_in_browser_view_coords);
167 gfx::Point test_point(point);
141 168
142 // Determine if the TabStrip exists and is capable of being clicked on. We 169 // Determine if the TabStrip exists and is capable of being clicked on. We
143 // might be a popup window without a TabStrip. 170 // might be a popup window without a TabStrip.
144 if (browser_view_->IsTabStripVisible()) { 171 if (browser_view_->IsTabStripVisible()) {
145 // See if the mouse pointer is within the bounds of the TabStrip. 172 // See if the mouse pointer is within the bounds of the TabStrip.
146 gfx::Point point_in_tabstrip_coords(point); 173 if (ConvertedHitTest(parent, tabstrip_, &test_point)) {
147 views::View::ConvertPointToView(parent, tabstrip_, 174 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; 175 return HTCAPTION;
152 return HTCLIENT; 176 return HTCLIENT;
153 } 177 }
154 178
179 // If the tabstrip is visible and we are in compact navigation mode, test
180 // against the compact navigation and option bars.
181 if (browser_view_->UseCompactNavigationBar()) {
182 test_point = point;
183 if (ConvertedHitTest(parent, compact_navigation_bar_, &test_point))
184 return HTCLIENT;
185 test_point = point;
186 if (ConvertedHitTest(parent, compact_options_bar_, &test_point))
187 return HTCLIENT;
188 }
189
155 // The top few pixels of the TabStrip are a drop-shadow - as we're pretty 190 // 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 191 // starved of dragable area, let's give it to window dragging (this also
157 // makes sense visually). 192 // makes sense visually).
158 if (!browser_view_->IsMaximized() && 193 if (!browser_view_->IsMaximized() &&
159 (point_in_browser_view_coords.y() < 194 (point_in_browser_view_coords.y() <
160 (tabstrip_->y() + kTabShadowSize))) { 195 (tabstrip_->y() + kTabShadowSize))) {
161 // We return HTNOWHERE as this is a signal to our containing 196 // We return HTNOWHERE as this is a signal to our containing
162 // NonClientView that it should figure out what the correct hit-test 197 // NonClientView that it should figure out what the correct hit-test
163 // code is given the mouse position... 198 // code is given the mouse position...
164 return HTNOWHERE; 199 return HTNOWHERE;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // BrowserViewLayout, views::LayoutManager implementation: 232 // BrowserViewLayout, views::LayoutManager implementation:
198 233
199 void BrowserViewLayout::Installed(views::View* host) { 234 void BrowserViewLayout::Installed(views::View* host) {
200 toolbar_ = NULL; 235 toolbar_ = NULL;
201 contents_split_ = NULL; 236 contents_split_ = NULL;
202 contents_container_ = NULL; 237 contents_container_ = NULL;
203 infobar_container_ = NULL; 238 infobar_container_ = NULL;
204 download_shelf_ = NULL; 239 download_shelf_ = NULL;
205 active_bookmark_bar_ = NULL; 240 active_bookmark_bar_ = NULL;
206 tabstrip_ = NULL; 241 tabstrip_ = NULL;
242 compact_navigation_bar_ = NULL;
243 compact_options_bar_ = NULL;
244 compact_spacer_ = NULL;
207 browser_view_ = static_cast<BrowserView*>(host); 245 browser_view_ = static_cast<BrowserView*>(host);
208 } 246 }
209 247
210 void BrowserViewLayout::Uninstalled(views::View* host) {} 248 void BrowserViewLayout::Uninstalled(views::View* host) {}
211 249
212 void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) { 250 void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) {
213 switch (view->GetID()) { 251 switch (view->GetID()) {
214 case VIEW_ID_CONTENTS_SPLIT: { 252 case VIEW_ID_CONTENTS_SPLIT: {
215 contents_split_ = static_cast<views::SingleSplitView*>(view); 253 contents_split_ = static_cast<views::SingleSplitView*>(view);
216 // We're installed as the LayoutManager before BrowserView creates the 254 // We're installed as the LayoutManager before BrowserView creates the
(...skipping 10 matching lines...) Expand all
227 break; 265 break;
228 case VIEW_ID_BOOKMARK_BAR: 266 case VIEW_ID_BOOKMARK_BAR:
229 active_bookmark_bar_ = static_cast<BookmarkBarView*>(view); 267 active_bookmark_bar_ = static_cast<BookmarkBarView*>(view);
230 break; 268 break;
231 case VIEW_ID_TOOLBAR: 269 case VIEW_ID_TOOLBAR:
232 toolbar_ = static_cast<ToolbarView*>(view); 270 toolbar_ = static_cast<ToolbarView*>(view);
233 break; 271 break;
234 case VIEW_ID_TAB_STRIP: 272 case VIEW_ID_TAB_STRIP:
235 tabstrip_ = static_cast<AbstractTabStripView*>(view); 273 tabstrip_ = static_cast<AbstractTabStripView*>(view);
236 break; 274 break;
275 case VIEW_ID_COMPACT_NAV_BAR_SPACER:
276 compact_spacer_ = view;
277 break;
278 case VIEW_ID_COMPACT_NAV_BAR:
279 compact_navigation_bar_ = view;
280 break;
281 case VIEW_ID_COMPACT_OPT_BAR:
282 compact_options_bar_ = view;
283 break;
237 } 284 }
238 } 285 }
239 286
240 void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) { 287 void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) {
241 switch (view->GetID()) { 288 switch (view->GetID()) {
242 case VIEW_ID_BOOKMARK_BAR: 289 case VIEW_ID_BOOKMARK_BAR:
243 active_bookmark_bar_ = NULL; 290 active_bookmark_bar_ = NULL;
244 break; 291 break;
245 } 292 }
246 } 293 }
247 294
248 void BrowserViewLayout::Layout(views::View* host) { 295 void BrowserViewLayout::Layout(views::View* host) {
249 vertical_layout_rect_ = browser_view_->GetLocalBounds(); 296 vertical_layout_rect_ = browser_view_->GetLocalBounds();
250 int top = LayoutTabStrip(); 297 int top = LayoutTabStripRegion();
251 if (browser_view_->IsTabStripVisible() && !browser_view_->UseVerticalTabs()) { 298 if (browser_view_->IsTabStripVisible() && !browser_view_->UseVerticalTabs()) {
252 tabstrip_->SetBackgroundOffset(gfx::Point( 299 tabstrip_->SetBackgroundOffset(gfx::Point(
253 tabstrip_->GetMirroredX() + browser_view_->GetMirroredX(), 300 tabstrip_->GetMirroredX() + browser_view_->GetMirroredX(),
254 browser_view_->frame()->GetHorizontalTabStripVerticalOffset(false))); 301 browser_view_->frame()->GetHorizontalTabStripVerticalOffset(false)));
255 } 302 }
256 top = LayoutToolbar(top); 303 top = LayoutToolbar(top);
257 top = LayoutBookmarkAndInfoBars(top); 304 top = LayoutBookmarkAndInfoBars(top);
258 int bottom = LayoutDownloadShelf(browser_view_->height()); 305 int bottom = LayoutDownloadShelf(browser_view_->height());
259 int active_top_margin = GetTopMarginForActiveContent(); 306 int active_top_margin = GetTopMarginForActiveContent();
260 top -= active_top_margin; 307 top -= active_top_margin;
261 contents_container_->SetActiveTopMargin(active_top_margin); 308 contents_container_->SetActiveTopMargin(active_top_margin);
262 LayoutTabContents(top, bottom); 309 LayoutTabContents(top, bottom);
263 // This must be done _after_ we lay out the TabContents since this 310 // 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 311 // 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 312 // must be laid out within, and that code depends on the
266 // TabContentsContainer's bounds being up to date. 313 // TabContentsContainer's bounds being up to date.
267 if (browser()->HasFindBarController()) { 314 if (browser()->HasFindBarController()) {
268 browser()->GetFindBarController()->find_bar()->MoveWindowIfNecessary( 315 browser()->GetFindBarController()->find_bar()->MoveWindowIfNecessary(
269 gfx::Rect(), true); 316 gfx::Rect(), true);
270 } 317 }
318 if (browser()->UseCompactNavigationBar()) {
319 DCHECK(browser_view_->compact_location_bar_view_host());
320 browser_view_->compact_location_bar_view_host()->MoveWindowIfNecessary(
321 gfx::Rect(), true);
322 }
271 } 323 }
272 324
273 // Return the preferred size which is the size required to give each 325 // Return the preferred size which is the size required to give each
274 // children their respective preferred size. 326 // children their respective preferred size.
275 gfx::Size BrowserViewLayout::GetPreferredSize(views::View* host) { 327 gfx::Size BrowserViewLayout::GetPreferredSize(views::View* host) {
276 return gfx::Size(); 328 return gfx::Size();
277 } 329 }
278 330
279 ////////////////////////////////////////////////////////////////////////////// 331 //////////////////////////////////////////////////////////////////////////////
280 // BrowserViewLayout, private: 332 // BrowserViewLayout, private:
281 333
282 Browser* BrowserViewLayout::browser() { 334 Browser* BrowserViewLayout::browser() {
283 return browser_view_->browser(); 335 return browser_view_->browser();
284 } 336 }
285 337
286 const Browser* BrowserViewLayout::browser() const { 338 const Browser* BrowserViewLayout::browser() const {
287 return browser_view_->browser(); 339 return browser_view_->browser();
288 } 340 }
289 341
290 int BrowserViewLayout::LayoutTabStrip() { 342 int BrowserViewLayout::LayoutTabStripRegion() {
291 if (!browser_view_->IsTabStripVisible()) { 343 if (!browser_view_->IsTabStripVisible()) {
344 if (compact_navigation_bar_ && compact_options_bar_) {
345 compact_navigation_bar_->SetVisible(false);
346 compact_options_bar_->SetVisible(false);
347 }
292 tabstrip_->SetVisible(false); 348 tabstrip_->SetVisible(false);
293 tabstrip_->SetBounds(0, 0, 0, 0); 349 tabstrip_->SetBounds(0, 0, 0, 0);
294 return 0; 350 return 0;
295 } 351 }
296 352
353 // This retrieves the bounds for the tab strip based on whether or not we show
354 // anything to the left of it, like the incognito avatar.
297 gfx::Rect tabstrip_bounds( 355 gfx::Rect tabstrip_bounds(
298 browser_view_->frame()->GetBoundsForTabStrip(tabstrip_)); 356 browser_view_->frame()->GetBoundsForTabStrip(tabstrip_));
299 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); 357 gfx::Point tabstrip_origin(tabstrip_bounds.origin());
300 views::View::ConvertPointToView(browser_view_->parent(), browser_view_, 358 views::View::ConvertPointToView(browser_view_->parent(), browser_view_,
301 &tabstrip_origin); 359 &tabstrip_origin);
302 tabstrip_bounds.set_origin(tabstrip_origin); 360 tabstrip_bounds.set_origin(tabstrip_origin);
303 361
362 // If we are in compact nav mode, we want to reduce the tab strip bounds from
363 // both ends enough to lay out the compact navigation and options bars. We
364 // check the pointers to see if the mode is available, and then check the pref
365 // to see if the mode is enabled (and therefore if the additional bars should
366 // be made visible).
367 if (compact_navigation_bar_ && compact_options_bar_) {
368 compact_navigation_bar_->SetVisible(
369 browser_view_->UseCompactNavigationBar());
370 compact_options_bar_->SetVisible(browser_view_->UseCompactNavigationBar());
371
372 if (compact_navigation_bar_->IsVisible()) {
373 gfx::Rect cnav_bar_bounds;
374 gfx::Size cnav_bar_size = compact_navigation_bar_->GetPreferredSize();
375 cnav_bar_bounds.set_origin(tabstrip_bounds.origin());
376 cnav_bar_bounds.set_size(cnav_bar_size);
377 compact_navigation_bar_->SetBoundsRect(cnav_bar_bounds);
378
379 // The options bar is flush right of the tab strip region.
380 gfx::Rect copt_bar_bounds;
381 gfx::Size copt_bar_size = compact_options_bar_->GetPreferredSize();
382 copt_bar_bounds.set_x(std::max(0, tabstrip_bounds.right() -
383 copt_bar_size.width()));
384 copt_bar_bounds.set_y(tabstrip_origin.y());
385 copt_bar_bounds.set_size(copt_bar_size);
386 compact_options_bar_->SetBoundsRect(copt_bar_bounds);
387
388 // Reduce the bounds of the tab strip accordingly.
389 tabstrip_bounds.set_x(tabstrip_bounds.x() + cnav_bar_size.width() +
390 kCompactNavbarHorizontalPadding);
391 tabstrip_bounds.set_width(std::max(0, tabstrip_bounds.width() -
392 cnav_bar_size.width() - copt_bar_size.width() -
393 kCompactNavbarHorizontalPadding * 2));
394 }
395 }
396
304 if (browser_view_->UseVerticalTabs()) 397 if (browser_view_->UseVerticalTabs())
305 vertical_layout_rect_.Inset(tabstrip_bounds.width(), 0, 0, 0); 398 vertical_layout_rect_.Inset(tabstrip_bounds.width(), 0, 0, 0);
306 399
307 tabstrip_->SetVisible(true); 400 tabstrip_->SetVisible(true);
308 tabstrip_->SetBoundsRect(tabstrip_bounds); 401 tabstrip_->SetBoundsRect(tabstrip_bounds);
309 return browser_view_->UseVerticalTabs() ? 402 return browser_view_->UseVerticalTabs() ?
310 tabstrip_bounds.y() : tabstrip_bounds.bottom(); 403 tabstrip_bounds.y() : tabstrip_bounds.bottom();
311 } 404 }
312 405
313 int BrowserViewLayout::LayoutToolbar(int top) { 406 int BrowserViewLayout::LayoutToolbar(int top) {
314 int browser_view_width = vertical_layout_rect_.width(); 407 int browser_view_width = vertical_layout_rect_.width();
315 bool visible = browser_view_->IsToolbarVisible(); 408 bool toolbar_visible = browser_view_->IsToolbarVisible();
316 toolbar_->location_bar()->SetFocusable(visible); 409 toolbar_->location_bar()->SetFocusable(toolbar_visible);
317 int y = top; 410 int y = top;
318 if (!browser_view_->UseVerticalTabs()) { 411 if (!browser_view_->UseVerticalTabs()) {
319 y -= ((visible && browser_view_->IsTabStripVisible()) ? 412 y -= ((toolbar_visible || browser_view_->UseCompactNavigationBar()) &&
320 kToolbarTabStripVerticalOverlap : 0); 413 browser_view_->IsTabStripVisible()) ?
414 kToolbarTabStripVerticalOverlap : 0;
321 } 415 }
322 int height = visible ? toolbar_->GetPreferredSize().height() : 0; 416 int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
323 toolbar_->SetVisible(visible); 417 toolbar_->SetVisible(toolbar_visible);
324 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height); 418 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height);
419
420 // The spacer essentially replaces the toolbar when in compact mode.
421 if (browser_view_->UseCompactNavigationBar()) {
422 compact_spacer_->SetVisible(!toolbar_visible);
423 compact_spacer_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width,
424 toolbar_visible ? 0 : kCompactNavbarSpacerHeight);
425 height = kCompactNavbarSpacerHeight;
426 }
427
325 return y + height; 428 return y + height;
326 } 429 }
327 430
328 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top) { 431 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top) {
329 find_bar_y_ = top + browser_view_->y() - 1; 432 find_bar_y_ = top + browser_view_->y() - 1;
330 if (active_bookmark_bar_) { 433 if (active_bookmark_bar_) {
331 // If we're showing the Bookmark bar in detached style, then we 434 // 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 435 // 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. 436 // Bookmark bar is styled to look like it's part of the page.
334 if (active_bookmark_bar_->IsDetached()) 437 if (active_bookmark_bar_->IsDetached())
335 return LayoutBookmarkBar(LayoutInfoBar(top)); 438 return LayoutBookmarkBar(LayoutInfoBar(top));
336 // Otherwise, Bookmark bar first, Info bar second. 439 // Otherwise, Bookmark bar first, Info bar second.
337 top = std::max(toolbar_->bounds().bottom(), LayoutBookmarkBar(top)); 440 top = std::max(toolbar_->bounds().bottom(), LayoutBookmarkBar(top));
338 } 441 }
339 find_bar_y_ = top + browser_view_->y() - 1; 442 find_bar_y_ = top + browser_view_->y() - 1;
340 return LayoutInfoBar(top); 443 return LayoutInfoBar(top);
341 } 444 }
342 445
343 int BrowserViewLayout::LayoutBookmarkBar(int top) { 446 int BrowserViewLayout::LayoutBookmarkBar(int top) {
344 DCHECK(active_bookmark_bar_); 447 DCHECK(active_bookmark_bar_);
345 int y = top; 448 int y = top;
346 if (!browser_view_->IsBookmarkBarVisible()) { 449 if (!browser_view_->IsBookmarkBarVisible()) {
347 active_bookmark_bar_->SetVisible(false); 450 active_bookmark_bar_->SetVisible(false);
348 active_bookmark_bar_->SetBounds(0, y, browser_view_->width(), 0); 451 active_bookmark_bar_->SetBounds(0, y, browser_view_->width(), 0);
349 return y; 452 return y;
350 } 453 }
351 454
352 active_bookmark_bar_->set_infobar_visible(InfobarVisible()); 455 active_bookmark_bar_->set_infobar_visible(InfobarVisible());
353 int bookmark_bar_height = active_bookmark_bar_->GetPreferredSize().height(); 456 int bookmark_bar_height = active_bookmark_bar_->GetPreferredSize().height();
354 y -= views::NonClientFrameView::kClientEdgeThickness + 457 if (!browser_view_->UseCompactNavigationBar()) {
355 active_bookmark_bar_->GetToolbarOverlap(false); 458 y -= views::NonClientFrameView::kClientEdgeThickness +
459 active_bookmark_bar_->GetToolbarOverlap(false);
460 } else {
461 y -= kSpacerBookmarkBarOverlap;
462 }
356 active_bookmark_bar_->SetVisible(true); 463 active_bookmark_bar_->SetVisible(true);
357 active_bookmark_bar_->SetBounds(vertical_layout_rect_.x(), y, 464 active_bookmark_bar_->SetBounds(vertical_layout_rect_.x(), y,
358 vertical_layout_rect_.width(), 465 vertical_layout_rect_.width(),
359 bookmark_bar_height); 466 bookmark_bar_height);
360 return y + bookmark_bar_height; 467 return y + bookmark_bar_height;
361 } 468 }
362 469
363 int BrowserViewLayout::LayoutInfoBar(int top) { 470 int BrowserViewLayout::LayoutInfoBar(int top) {
364 // Raise the |infobar_container_| by its vertical overlap. 471 // Raise the |infobar_container_| by its vertical overlap.
365 infobar_container_->SetVisible(InfobarVisible()); 472 infobar_container_->SetVisible(InfobarVisible());
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 bottom -= height; 627 bottom -= height;
521 } 628 }
522 return bottom; 629 return bottom;
523 } 630 }
524 631
525 bool BrowserViewLayout::InfobarVisible() const { 632 bool BrowserViewLayout::InfobarVisible() const {
526 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 633 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
527 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 634 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
528 (infobar_container_->GetPreferredSize().height() != 0); 635 (infobar_container_->GetPreferredSize().height() != 0);
529 } 636 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.h ('k') | chrome/browser/ui/views/frame/opaque_browser_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698