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.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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 return browser_->GetActiveWebContents(); | 512 return browser_->GetActiveWebContents(); |
513 } | 513 } |
514 | 514 |
515 TabContents* BrowserView::GetActiveTabContents() const { | 515 TabContents* BrowserView::GetActiveTabContents() const { |
516 return browser_->GetActiveTabContents(); | 516 return browser_->GetActiveTabContents(); |
517 } | 517 } |
518 | 518 |
519 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { | 519 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { |
520 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 520 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
521 const gfx::ImageSkia* otr_avatar = | 521 const gfx::ImageSkia* otr_avatar = |
522 rb.GetNativeImageNamed(IDR_OTR_ICON).ToImageSkia(); | 522 rb.GetNativeImageNamed(GetOTRIconResourceID()).ToImageSkia(); |
523 return *otr_avatar; | 523 return *otr_avatar; |
524 } | 524 } |
525 | 525 |
526 bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) { | 526 bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) { |
527 return GetBrowserViewLayout()->IsPositionInWindowCaption(point); | 527 return GetBrowserViewLayout()->IsPositionInWindowCaption(point); |
528 } | 528 } |
529 | 529 |
530 /////////////////////////////////////////////////////////////////////////////// | 530 /////////////////////////////////////////////////////////////////////////////// |
531 // BrowserView, BrowserWindow implementation: | 531 // BrowserView, BrowserWindow implementation: |
532 | 532 |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 sender->child_at(i)->InvalidateLayout(); | 1776 sender->child_at(i)->InvalidateLayout(); |
1777 SchedulePaint(); | 1777 SchedulePaint(); |
1778 Layout(); | 1778 Layout(); |
1779 return false; | 1779 return false; |
1780 } | 1780 } |
1781 | 1781 |
1782 void BrowserView::OnSysColorChange() { | 1782 void BrowserView::OnSysColorChange() { |
1783 browser::MaybeShowInvertBubbleView(browser_->profile(), contents_); | 1783 browser::MaybeShowInvertBubbleView(browser_->profile(), contents_); |
1784 } | 1784 } |
1785 | 1785 |
| 1786 int BrowserView::GetOTRIconResourceID() const { |
| 1787 int otr_resource_id = IDR_OTR_ICON; |
| 1788 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { |
| 1789 if (IsFullscreen()) |
| 1790 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; |
| 1791 #if defined(OS_WIN) && !defined(USE_AURA) |
| 1792 if (base::win::GetMetroModule() != NULL) |
| 1793 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; |
| 1794 #endif |
| 1795 } |
| 1796 |
| 1797 return otr_resource_id; |
| 1798 } |
| 1799 |
1786 views::LayoutManager* BrowserView::CreateLayoutManager() const { | 1800 views::LayoutManager* BrowserView::CreateLayoutManager() const { |
1787 return new BrowserViewLayout; | 1801 return new BrowserViewLayout; |
1788 } | 1802 } |
1789 | 1803 |
1790 ToolbarView* BrowserView::CreateToolbar() const { | 1804 ToolbarView* BrowserView::CreateToolbar() const { |
1791 return new ToolbarView(browser_.get()); | 1805 return new ToolbarView(browser_.get()); |
1792 } | 1806 } |
1793 | 1807 |
1794 void BrowserView::Init() { | 1808 void BrowserView::Init() { |
1795 GetWidget()->AddObserver(this); | 1809 GetWidget()->AddObserver(this); |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 this, | 2447 this, |
2434 tab_contents->web_contents()->GetRenderViewHost(), | 2448 tab_contents->web_contents()->GetRenderViewHost(), |
2435 password_generator, | 2449 password_generator, |
2436 browser_.get(), | 2450 browser_.get(), |
2437 tab_contents->password_manager()); | 2451 tab_contents->password_manager()); |
2438 | 2452 |
2439 views::BubbleDelegateView::CreateBubble(bubble); | 2453 views::BubbleDelegateView::CreateBubble(bubble); |
2440 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2454 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
2441 bubble->Show(); | 2455 bubble->Show(); |
2442 } | 2456 } |
OLD | NEW |