OLD | NEW |
---|---|
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/tabs/tab_strip.h" | 17 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 views::View::ConvertPointToTarget(browser_view_->parent(), browser_view_, | 313 views::View::ConvertPointToTarget(browser_view_->parent(), browser_view_, |
313 &tabstrip_origin); | 314 &tabstrip_origin); |
314 tabstrip_bounds.set_origin(tabstrip_origin); | 315 tabstrip_bounds.set_origin(tabstrip_origin); |
315 | 316 |
316 tabstrip_->SetVisible(true); | 317 tabstrip_->SetVisible(true); |
317 tabstrip_->SetBoundsRect(tabstrip_bounds); | 318 tabstrip_->SetBoundsRect(tabstrip_bounds); |
318 int bottom = tabstrip_bounds.bottom(); | 319 int bottom = tabstrip_bounds.bottom(); |
319 | 320 |
320 // The metro window switcher sits at the far right edge of the tabstrip | 321 // The metro window switcher sits at the far right edge of the tabstrip |
321 // a |kWindowSwitcherOffsetX| pixels from the right edge. | 322 // a |kWindowSwitcherOffsetX| pixels from the right edge. |
322 // Only visible if there is an incognito window because switching between | 323 // Only visible if there is both an incognito window AND a regular window |
323 // regular and incognito windows is the only use case that works right now. | 324 // because switching between regular and incognito windows is the only use |
325 // case that works right now. | |
Peter Kasting
2012/08/24 22:19:32
Nit: Is there some sort of applicable "TODO: Expan
| |
324 views::Button* switcher_button = browser_view_->window_switcher_button_; | 326 views::Button* switcher_button = browser_view_->window_switcher_button_; |
325 if (switcher_button) { | 327 if (switcher_button) { |
326 if (browser_view_->browser()->profile()->HasOffTheRecordProfile()) { | 328 if (browser_view_->browser()->profile()->HasOffTheRecordProfile() && |
Peter Kasting
2012/08/24 22:19:32
Nit: Switch all "browser_view_->browser()" calls t
| |
329 browser::FindBrowserWithProfile( | |
330 browser_view_->browser()->profile()->GetOriginalProfile(), | |
331 browser_view_->browser()->host_desktop_type()) != NULL) { | |
327 switcher_button->SetVisible(true); | 332 switcher_button->SetVisible(true); |
328 int width = browser_view_->width(); | 333 int width = browser_view_->width(); |
329 gfx::Size ps = switcher_button->GetPreferredSize(); | 334 gfx::Size ps = switcher_button->GetPreferredSize(); |
330 if (width > ps.width()) { | 335 if (width > ps.width()) { |
331 switcher_button->SetBounds(width - ps.width() - kWindowSwitcherOffsetX, | 336 switcher_button->SetBounds(width - ps.width() - kWindowSwitcherOffsetX, |
332 0, | 337 0, |
333 ps.width(), | 338 ps.width(), |
334 ps.height()); | 339 ps.height()); |
335 } | 340 } |
336 } else { | 341 } else { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 bottom -= height; | 483 bottom -= height; |
479 } | 484 } |
480 return bottom; | 485 return bottom; |
481 } | 486 } |
482 | 487 |
483 bool BrowserViewLayout::InfobarVisible() const { | 488 bool BrowserViewLayout::InfobarVisible() const { |
484 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 489 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
485 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 490 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
486 (infobar_container_->GetPreferredSize().height() != 0); | 491 (infobar_container_->GetPreferredSize().height() != 0); |
487 } | 492 } |
OLD | NEW |