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

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

Issue 10823414: Also hide incognito switcher when no regular window is available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OWNER review comments addressed. Created 8 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/browser_finder.h"
7 #include "chrome/browser/ui/find_bar/find_bar.h" 8 #include "chrome/browser/ui/find_bar/find_bar.h"
8 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
9 #include "chrome/browser/ui/view_ids.h" 10 #include "chrome/browser/ui/view_ids.h"
10 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 11 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
11 #include "chrome/browser/ui/views/download/download_shelf_view.h" 12 #include "chrome/browser/ui/views/download/download_shelf_view.h"
12 #include "chrome/browser/ui/views/frame/browser_frame.h" 13 #include "chrome/browser/ui/views/frame/browser_frame.h"
13 #include "chrome/browser/ui/views/frame/browser_view.h" 14 #include "chrome/browser/ui/views/frame/browser_view.h"
14 #include "chrome/browser/ui/views/frame/contents_container.h" 15 #include "chrome/browser/ui/views/frame/contents_container.h"
15 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" 16 #include "chrome/browser/ui/views/infobars/infobar_container_view.h"
16 #include "chrome/browser/ui/views/location_bar/location_bar_container.h" 17 #include "chrome/browser/ui/views/location_bar/location_bar_container.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 views::View::ConvertPointToTarget(browser_view_->parent(), browser_view_, 314 views::View::ConvertPointToTarget(browser_view_->parent(), browser_view_,
314 &tabstrip_origin); 315 &tabstrip_origin);
315 tabstrip_bounds.set_origin(tabstrip_origin); 316 tabstrip_bounds.set_origin(tabstrip_origin);
316 317
317 tabstrip_->SetVisible(true); 318 tabstrip_->SetVisible(true);
318 tabstrip_->SetBoundsRect(tabstrip_bounds); 319 tabstrip_->SetBoundsRect(tabstrip_bounds);
319 int bottom = tabstrip_bounds.bottom(); 320 int bottom = tabstrip_bounds.bottom();
320 321
321 // The metro window switcher sits at the far right edge of the tabstrip 322 // The metro window switcher sits at the far right edge of the tabstrip
322 // a |kWindowSwitcherOffsetX| pixels from the right edge. 323 // a |kWindowSwitcherOffsetX| pixels from the right edge.
323 // Only visible if there is an incognito window because switching between 324 // Only visible if there is more than one type of window to switch between.
324 // regular and incognito windows is the only use case that works right now. 325 // TODO(mad): update this code when more window types than just incognito
326 // and regular are available.
325 views::Button* switcher_button = browser_view_->window_switcher_button_; 327 views::Button* switcher_button = browser_view_->window_switcher_button_;
326 if (switcher_button) { 328 if (switcher_button) {
327 if (browser_view_->browser()->profile()->HasOffTheRecordProfile()) { 329 if (browser()->profile()->HasOffTheRecordProfile() &&
330 browser::FindBrowserWithProfile(
331 browser()->profile()->GetOriginalProfile(),
332 browser()->host_desktop_type()) != NULL) {
328 switcher_button->SetVisible(true); 333 switcher_button->SetVisible(true);
329 int width = browser_view_->width(); 334 int width = browser_view_->width();
330 gfx::Size ps = switcher_button->GetPreferredSize(); 335 gfx::Size ps = switcher_button->GetPreferredSize();
331 if (width > ps.width()) { 336 if (width > ps.width()) {
332 switcher_button->SetBounds(width - ps.width() - kWindowSwitcherOffsetX, 337 switcher_button->SetBounds(width - ps.width() - kWindowSwitcherOffsetX,
333 0, 338 0,
334 ps.width(), 339 ps.width(),
335 ps.height()); 340 ps.height());
336 } 341 }
337 } else { 342 } else {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 bottom -= height; 485 bottom -= height;
481 } 486 }
482 return bottom; 487 return bottom;
483 } 488 }
484 489
485 bool BrowserViewLayout::InfobarVisible() const { 490 bool BrowserViewLayout::InfobarVisible() const {
486 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 491 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
487 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 492 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
488 (infobar_container_->GetPreferredSize().height() != 0); 493 (infobar_container_->GetPreferredSize().height() != 0);
489 } 494 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698