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.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 546 } |
547 | 547 |
548 bool BrowserView::IsGuestSession() const { | 548 bool BrowserView::IsGuestSession() const { |
549 return browser_->profile()->IsGuestSession(); | 549 return browser_->profile()->IsGuestSession(); |
550 } | 550 } |
551 | 551 |
552 bool BrowserView::IsRegularOrGuestSession() const { | 552 bool BrowserView::IsRegularOrGuestSession() const { |
553 return profiles::IsRegularOrGuestSession(browser_.get()); | 553 return profiles::IsRegularOrGuestSession(browser_.get()); |
554 } | 554 } |
555 | 555 |
556 int BrowserView::GetOTRIconResourceID() const { | |
557 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH && IsFullscreen()) | |
558 return IDR_OTR_ICON_FULLSCREEN; | |
559 return IDR_OTR_ICON; | |
560 } | |
561 | |
562 bool BrowserView::ShouldShowAvatar() const { | 556 bool BrowserView::ShouldShowAvatar() const { |
563 #if defined(OS_CHROMEOS) | 557 #if defined(OS_CHROMEOS) |
564 if (!browser_->is_type_tabbed() && !browser_->is_app()) | 558 if (!browser_->is_type_tabbed() && !browser_->is_app()) |
565 return false; | 559 return false; |
566 // Don't show incognito avatar in the guest session. | 560 // Don't show incognito avatar in the guest session. |
567 if (IsOffTheRecord() && !IsGuestSession()) | 561 if (IsOffTheRecord() && !IsGuestSession()) |
568 return true; | 562 return true; |
569 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo | 563 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo |
570 // during the creation of the BrowserWindow, so browser->window() will not | 564 // during the creation of the BrowserWindow, so browser->window() will not |
571 // yet be set. In this case we can safely return false. | 565 // yet be set. In this case we can safely return false. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 606 |
613 bool BrowserView::IsAcceleratorRegistered(const ui::Accelerator& accelerator) { | 607 bool BrowserView::IsAcceleratorRegistered(const ui::Accelerator& accelerator) { |
614 return accelerator_table_.find(accelerator) != accelerator_table_.end(); | 608 return accelerator_table_.find(accelerator) != accelerator_table_.end(); |
615 } | 609 } |
616 | 610 |
617 WebContents* BrowserView::GetActiveWebContents() const { | 611 WebContents* BrowserView::GetActiveWebContents() const { |
618 return browser_->tab_strip_model()->GetActiveWebContents(); | 612 return browser_->tab_strip_model()->GetActiveWebContents(); |
619 } | 613 } |
620 | 614 |
621 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { | 615 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { |
622 return *GetThemeProvider()->GetImageSkiaNamed(GetOTRIconResourceID()); | 616 return *GetThemeProvider()->GetImageSkiaNamed(IDR_OTR_ICON); |
623 } | 617 } |
624 | 618 |
625 /////////////////////////////////////////////////////////////////////////////// | 619 /////////////////////////////////////////////////////////////////////////////// |
626 // BrowserView, BrowserWindow implementation: | 620 // BrowserView, BrowserWindow implementation: |
627 | 621 |
628 void BrowserView::Show() { | 622 void BrowserView::Show() { |
629 // If the window is already visible, just activate it. | 623 // If the window is already visible, just activate it. |
630 if (frame_->IsVisible()) { | 624 if (frame_->IsVisible()) { |
631 frame_->Activate(); | 625 frame_->Activate(); |
632 return; | 626 return; |
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2542 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2536 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2543 gfx::Point icon_bottom( | 2537 gfx::Point icon_bottom( |
2544 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2538 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2545 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2539 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2546 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2540 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2547 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2541 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2548 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2542 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2549 } | 2543 } |
2550 return top_arrow_height; | 2544 return top_arrow_height; |
2551 } | 2545 } |
OLD | NEW |