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

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

Issue 12387089: Instant: Rename 'preview' to 'overlay' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser_finder.h" 8 #include "chrome/browser/ui/browser_finder.h"
9 #include "chrome/browser/ui/find_bar/find_bar.h" 9 #include "chrome/browser/ui/find_bar/find_bar.h"
10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 void BrowserViewLayout::Layout(views::View* host) { 262 void BrowserViewLayout::Layout(views::View* host) {
263 // Showing instant extended suggestions causes us to temporarily hide any 263 // Showing instant extended suggestions causes us to temporarily hide any
264 // visible bookmark bar and infobars. In turn, this hiding would normally 264 // visible bookmark bar and infobars. In turn, this hiding would normally
265 // cause the content below the suggestions to shift upwards, which looks 265 // cause the content below the suggestions to shift upwards, which looks
266 // surprising (since from the user's perspective, we're "covering" rather than 266 // surprising (since from the user's perspective, we're "covering" rather than
267 // "removing" the bookmark bar/infobars). To prevent this, we save off the 267 // "removing" the bookmark bar/infobars). To prevent this, we save off the
268 // content origin here, then once we finish laying things out, force the 268 // content origin here, then once we finish laying things out, force the
269 // contents to continue to display from that origin. 269 // contents to continue to display from that origin.
270 const chrome::search::Mode& mode = browser()->search_model()->mode(); 270 const chrome::search::Mode& mode = browser()->search_model()->mode();
271 views::WebView* contents = browser_view_->contents_container_; 271 views::WebView* contents = browser_view_->contents_container_;
272 int preview_height = contents_container_->preview_height(); 272 int overlay_height = contents_container_->overlay_height();
273 gfx::Point old_contents_origin; 273 gfx::Point old_contents_origin;
274 if (preview_height > 0 && mode.is_search_suggestions() && 274 if (overlay_height > 0 && mode.is_search_suggestions() &&
275 mode.is_origin_default()) { 275 mode.is_origin_default()) {
276 old_contents_origin = contents->bounds().origin(); 276 old_contents_origin = contents->bounds().origin();
277 views::View::ConvertPointToTarget(contents->parent(), browser_view_, 277 views::View::ConvertPointToTarget(contents->parent(), browser_view_,
278 &old_contents_origin); 278 &old_contents_origin);
279 } 279 }
280 280
281 vertical_layout_rect_ = browser_view_->GetLocalBounds(); 281 vertical_layout_rect_ = browser_view_->GetLocalBounds();
282 int top = LayoutTabStripRegion(); 282 int top = LayoutTabStripRegion();
283 if (browser_view_->IsTabStripVisible()) { 283 if (browser_view_->IsTabStripVisible()) {
284 int x = browser_view_->tabstrip_->GetMirroredX() + 284 int x = browser_view_->tabstrip_->GetMirroredX() +
(...skipping 22 matching lines...) Expand all
307 if (active_top_margin == 0 && !old_contents_origin.IsOrigin()) { 307 if (active_top_margin == 0 && !old_contents_origin.IsOrigin()) {
308 gfx::Point new_contents_origin(contents->bounds().origin()); 308 gfx::Point new_contents_origin(contents->bounds().origin());
309 views::View::ConvertPointToTarget(contents->parent(), browser_view_, 309 views::View::ConvertPointToTarget(contents->parent(), browser_view_,
310 &new_contents_origin); 310 &new_contents_origin);
311 active_top_margin = old_contents_origin.y() - new_contents_origin.y(); 311 active_top_margin = old_contents_origin.y() - new_contents_origin.y();
312 // Special case: While normally the suggestions appear to "cover" any 312 // Special case: While normally the suggestions appear to "cover" any
313 // bookmark/infobars, if the suggestions are very short, they might not 313 // bookmark/infobars, if the suggestions are very short, they might not
314 // fully cover that gap, and leaving the contents at their original height 314 // fully cover that gap, and leaving the contents at their original height
315 // would leave an odd-looking blank space. In this case, we allow the 315 // would leave an odd-looking blank space. In this case, we allow the
316 // contents to go ahead and shift upward. 316 // contents to go ahead and shift upward.
317 if (active_top_margin > 0 && active_top_margin < preview_height) 317 if (active_top_margin > 0 && active_top_margin < overlay_height)
318 contents_container_->SetActiveTopMargin(active_top_margin); 318 contents_container_->SetActiveTopMargin(active_top_margin);
319 } 319 }
320 320
321 // This must be done _after_ we lay out the WebContents since this 321 // This must be done _after_ we lay out the WebContents since this
322 // code calls back into us to find the bounding box the find bar 322 // code calls back into us to find the bounding box the find bar
323 // must be laid out within, and that code depends on the 323 // must be laid out within, and that code depends on the
324 // TabContentsContainer's bounds being up to date. 324 // TabContentsContainer's bounds being up to date.
325 if (browser()->HasFindBarController()) { 325 if (browser()->HasFindBarController()) {
326 browser()->GetFindBarController()->find_bar()->MoveWindowIfNecessary( 326 browser()->GetFindBarController()->find_bar()->MoveWindowIfNecessary(
327 gfx::Rect(), true); 327 gfx::Rect(), true);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } 534 }
535 return bottom; 535 return bottom;
536 } 536 }
537 537
538 bool BrowserViewLayout::InfobarVisible() const { 538 bool BrowserViewLayout::InfobarVisible() const {
539 views::View* infobar_container = browser_view_->infobar_container_; 539 views::View* infobar_container = browser_view_->infobar_container_;
540 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 540 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
541 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 541 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
542 (infobar_container->GetPreferredSize().height() != 0); 542 (infobar_container->GetPreferredSize().height() != 0);
543 } 543 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/frame/contents_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698