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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 281 |
282 void BrowserViewLayout::Uninstalled(views::View* host) {} | 282 void BrowserViewLayout::Uninstalled(views::View* host) {} |
283 | 283 |
284 void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) { | 284 void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) { |
285 switch (view->id()) { | 285 switch (view->id()) { |
286 case VIEW_ID_CONTENTS_SPLIT: { | 286 case VIEW_ID_CONTENTS_SPLIT: { |
287 contents_split_ = static_cast<views::SingleSplitView*>(view); | 287 contents_split_ = static_cast<views::SingleSplitView*>(view); |
288 // We're installed as the LayoutManager before BrowserView creates the | 288 // We're installed as the LayoutManager before BrowserView creates the |
289 // contents, so we have to set contents_container_ here rather than in | 289 // contents, so we have to set contents_container_ here rather than in |
290 // Installed. | 290 // Installed. |
291 contents_container_ = browser_view_->contents_; | 291 contents_container_ = browser_view_->contents_container_; |
292 break; | 292 break; |
293 } | 293 } |
294 case VIEW_ID_DOWNLOAD_SHELF: | 294 case VIEW_ID_DOWNLOAD_SHELF: |
295 download_shelf_ = static_cast<DownloadShelfView*>(view); | 295 download_shelf_ = static_cast<DownloadShelfView*>(view); |
296 break; | 296 break; |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 void BrowserViewLayout::Layout(views::View* host) { | 300 void BrowserViewLayout::Layout(views::View* host) { |
301 // Showing Instant extended suggestions causes us to temporarily hide any | 301 // Showing Instant extended suggestions causes us to temporarily hide any |
302 // visible bookmark bar and infobars. In turn, this hiding would normally | 302 // visible bookmark bar and infobars. In turn, this hiding would normally |
303 // cause the content below the suggestions to shift upwards, which looks | 303 // cause the content below the suggestions to shift upwards, which looks |
304 // surprising (since from the user's perspective, we're "covering" rather than | 304 // surprising (since from the user's perspective, we're "covering" rather than |
305 // "removing" the bookmark bar/infobars). To prevent this, we save off the | 305 // "removing" the bookmark bar/infobars). To prevent this, we save off the |
306 // content origin here, then once we finish laying things out, force the | 306 // content origin here, then once we finish laying things out, force the |
307 // contents to continue to display from that origin. If suggestions | 307 // contents to continue to display from that origin. If suggestions |
308 // completely obscure the tab's contents, there's no need to modify the | 308 // completely obscure the tab's contents, there's no need to modify the |
309 // content origin. | 309 // content origin. |
310 views::WebView* contents = browser_view_->contents_container_; | 310 views::WebView* contents = browser_view_->contents_web_view_; |
311 int overlay_height = contents_container_->overlay_height(); | 311 int overlay_height = contents_container_->overlay_height(); |
312 gfx::Point old_contents_origin; | 312 gfx::Point old_contents_origin; |
313 if (overlay_height > 0 && !contents_container_->IsOverlayFullHeight()) { | 313 if (overlay_height > 0 && !contents_container_->IsOverlayFullHeight()) { |
314 old_contents_origin = contents->bounds().origin(); | 314 old_contents_origin = contents->bounds().origin(); |
315 views::View::ConvertPointToTarget(contents->parent(), browser_view_, | 315 views::View::ConvertPointToTarget(contents->parent(), browser_view_, |
316 &old_contents_origin); | 316 &old_contents_origin); |
317 } | 317 } |
318 | 318 |
319 vertical_layout_rect_ = browser_view_->GetLocalBounds(); | 319 vertical_layout_rect_ = browser_view_->GetLocalBounds(); |
320 int top = LayoutTabStripRegion(); | 320 int top = LayoutTabStripRegion(); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 } | 630 } |
631 return bottom; | 631 return bottom; |
632 } | 632 } |
633 | 633 |
634 bool BrowserViewLayout::InfobarVisible() const { | 634 bool BrowserViewLayout::InfobarVisible() const { |
635 views::View* infobar_container = browser_view_->infobar_container_; | 635 views::View* infobar_container = browser_view_->infobar_container_; |
636 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 636 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
637 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 637 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
638 (infobar_container->GetPreferredSize().height() != 0); | 638 (infobar_container->GetPreferredSize().height() != 0); |
639 } | 639 } |
OLD | NEW |