OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/observer_list.h" | 7 #include "base/observer_list.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
10 #include "chrome/browser/ui/find_bar/find_bar.h" | 10 #include "chrome/browser/ui/find_bar/find_bar.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHostViews); | 100 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHostViews); |
101 }; | 101 }; |
102 | 102 |
103 // static | 103 // static |
104 const int BrowserViewLayout::kToolbarTabStripVerticalOverlap = 3; | 104 const int BrowserViewLayout::kToolbarTabStripVerticalOverlap = 3; |
105 | 105 |
106 //////////////////////////////////////////////////////////////////////////////// | 106 //////////////////////////////////////////////////////////////////////////////// |
107 // BrowserViewLayout, public: | 107 // BrowserViewLayout, public: |
108 | 108 |
109 BrowserViewLayout::BrowserViewLayout() | 109 BrowserViewLayout::BrowserViewLayout(Browser* browser) |
110 : contents_split_(NULL), | 110 : browser_(browser), |
| 111 contents_split_(NULL), |
111 contents_container_(NULL), | 112 contents_container_(NULL), |
112 download_shelf_(NULL), | 113 download_shelf_(NULL), |
113 browser_view_(NULL), | 114 browser_view_(NULL), |
114 find_bar_y_(0), | 115 find_bar_y_(0), |
115 ALLOW_THIS_IN_INITIALIZER_LIST( | 116 ALLOW_THIS_IN_INITIALIZER_LIST( |
116 dialog_host_(new WebContentsModalDialogHostViews(this))), | 117 dialog_host_(new WebContentsModalDialogHostViews(this))), |
117 web_contents_modal_dialog_top_y_(-1) { | 118 web_contents_modal_dialog_top_y_(-1) { |
118 } | 119 } |
119 | 120 |
120 BrowserViewLayout::~BrowserViewLayout() { | 121 BrowserViewLayout::~BrowserViewLayout() { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 385 |
385 // Return the preferred size which is the size required to give each | 386 // Return the preferred size which is the size required to give each |
386 // children their respective preferred size. | 387 // children their respective preferred size. |
387 gfx::Size BrowserViewLayout::GetPreferredSize(views::View* host) { | 388 gfx::Size BrowserViewLayout::GetPreferredSize(views::View* host) { |
388 return gfx::Size(); | 389 return gfx::Size(); |
389 } | 390 } |
390 | 391 |
391 ////////////////////////////////////////////////////////////////////////////// | 392 ////////////////////////////////////////////////////////////////////////////// |
392 // BrowserViewLayout, private: | 393 // BrowserViewLayout, private: |
393 | 394 |
394 Browser* BrowserViewLayout::browser() { | |
395 return browser_view_->browser(); | |
396 } | |
397 | |
398 const Browser* BrowserViewLayout::browser() const { | |
399 return browser_view_->browser(); | |
400 } | |
401 | |
402 int BrowserViewLayout::LayoutTabStripRegion() { | 395 int BrowserViewLayout::LayoutTabStripRegion() { |
403 TabStrip* tabstrip = browser_view_->tabstrip_; | 396 TabStrip* tabstrip = browser_view_->tabstrip_; |
404 if (!browser_view_->IsTabStripVisible()) { | 397 if (!browser_view_->IsTabStripVisible()) { |
405 tabstrip->SetVisible(false); | 398 tabstrip->SetVisible(false); |
406 tabstrip->SetBounds(0, 0, 0, 0); | 399 tabstrip->SetBounds(0, 0, 0, 0); |
407 return 0; | 400 return 0; |
408 } | 401 } |
409 // This retrieves the bounds for the tab strip based on whether or not we show | 402 // This retrieves the bounds for the tab strip based on whether or not we show |
410 // anything to the left of it, like the incognito avatar. | 403 // anything to the left of it, like the incognito avatar. |
411 gfx::Rect tabstrip_bounds( | 404 gfx::Rect tabstrip_bounds( |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 vertical_layout_rect_.width(), height); | 620 vertical_layout_rect_.width(), height); |
628 download_shelf_->Layout(); | 621 download_shelf_->Layout(); |
629 bottom -= height; | 622 bottom -= height; |
630 } | 623 } |
631 return bottom; | 624 return bottom; |
632 } | 625 } |
633 | 626 |
634 bool BrowserViewLayout::InfobarVisible() const { | 627 bool BrowserViewLayout::InfobarVisible() const { |
635 views::View* infobar_container = browser_view_->infobar_container_; | 628 views::View* infobar_container = browser_view_->infobar_container_; |
636 // 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. |
637 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 630 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
638 (infobar_container->GetPreferredSize().height() != 0); | 631 (infobar_container->GetPreferredSize().height() != 0); |
639 } | 632 } |
OLD | NEW |