OLD | NEW |
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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 bookmark_bar_height); | 360 bookmark_bar_height); |
361 return y + bookmark_bar_height; | 361 return y + bookmark_bar_height; |
362 } | 362 } |
363 | 363 |
364 int BrowserViewLayout::LayoutInfoBar(int top) { | 364 int BrowserViewLayout::LayoutInfoBar(int top) { |
365 // Raise the |infobar_container_| by its overlapping tab_height. | 365 // Raise the |infobar_container_| by its overlapping tab_height. |
366 bool visible = InfobarVisible(); | 366 bool visible = InfobarVisible(); |
367 infobar_container_->SetVisible(visible); | 367 infobar_container_->SetVisible(visible); |
368 int height = infobar_container_->GetPreferredSize().height(); | 368 int height = infobar_container_->GetPreferredSize().height(); |
369 DCHECK(visible || !height) << "Invisible InfoBarContainer has height."; | 369 DCHECK(visible || !height) << "Invisible InfoBarContainer has height."; |
370 int overlapped_top = top - | 370 int overlapped_top = top - static_cast<InfoBarContainerView*>( |
371 static_cast<InfoBarContainerView*>(infobar_container_)->VerticalOverlap(); | 371 infobar_container_)->GetVerticalOverlap(); |
372 infobar_container_->SetBounds(vertical_layout_rect_.x(), | 372 infobar_container_->SetBounds(vertical_layout_rect_.x(), |
373 overlapped_top, | 373 overlapped_top, |
374 vertical_layout_rect_.width(), | 374 vertical_layout_rect_.width(), |
375 height); | 375 height); |
376 return overlapped_top + height; | 376 return overlapped_top + height; |
377 } | 377 } |
378 | 378 |
379 // |browser_reserved_rect| is in browser_view_ coordinates. | 379 // |browser_reserved_rect| is in browser_view_ coordinates. |
380 // |future_source_bounds| is in |source|'s parent coordinates. | 380 // |future_source_bounds| is in |source|'s parent coordinates. |
381 // |future_parent_offset| is required, since parent view is not moved yet. | 381 // |future_parent_offset| is required, since parent view is not moved yet. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 bottom -= height; | 521 bottom -= height; |
522 } | 522 } |
523 return bottom; | 523 return bottom; |
524 } | 524 } |
525 | 525 |
526 bool BrowserViewLayout::InfobarVisible() const { | 526 bool BrowserViewLayout::InfobarVisible() const { |
527 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 527 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
528 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 528 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
529 (infobar_container_->GetPreferredSize().height() != 0); | 529 (infobar_container_->GetPreferredSize().height() != 0); |
530 } | 530 } |
OLD | NEW |