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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 return browser_->GetSelectedWebContents(); | 511 return browser_->GetSelectedWebContents(); |
512 } | 512 } |
513 | 513 |
514 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const { | 514 TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const { |
515 return browser_->GetSelectedTabContentsWrapper(); | 515 return browser_->GetSelectedTabContentsWrapper(); |
516 } | 516 } |
517 | 517 |
518 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { | 518 gfx::ImageSkia BrowserView::GetOTRAvatarIcon() const { |
519 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 519 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
520 const gfx::ImageSkia* otr_avatar = | 520 const gfx::ImageSkia* otr_avatar = |
521 rb.GetNativeImageNamed(IDR_OTR_ICON).ToImageSkia(); | 521 rb.GetNativeImageNamed(GetOtrIconResourceID()).ToImageSkia(); |
522 return *otr_avatar; | 522 return *otr_avatar; |
523 } | 523 } |
524 | 524 |
525 bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) { | 525 bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) { |
526 return GetBrowserViewLayout()->IsPositionInWindowCaption(point); | 526 return GetBrowserViewLayout()->IsPositionInWindowCaption(point); |
527 } | 527 } |
528 | 528 |
529 /////////////////////////////////////////////////////////////////////////////// | 529 /////////////////////////////////////////////////////////////////////////////// |
530 // BrowserView, BrowserWindow implementation: | 530 // BrowserView, BrowserWindow implementation: |
531 | 531 |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1772 sender->child_at(i)->InvalidateLayout(); | 1772 sender->child_at(i)->InvalidateLayout(); |
1773 SchedulePaint(); | 1773 SchedulePaint(); |
1774 Layout(); | 1774 Layout(); |
1775 return false; | 1775 return false; |
1776 } | 1776 } |
1777 | 1777 |
1778 void BrowserView::OnSysColorChange() { | 1778 void BrowserView::OnSysColorChange() { |
1779 browser::MaybeShowInvertBubbleView(browser_->profile(), contents_); | 1779 browser::MaybeShowInvertBubbleView(browser_->profile(), contents_); |
1780 } | 1780 } |
1781 | 1781 |
1782 int BrowserView::GetOtrIconResourceID() const { | |
benrg
2012/06/11 20:35:45
I asked glen@ and he says this is correct.
Nit: y
Jói
2012/06/11 22:53:42
Thanks for checking.
Re the extra line: I prefer
| |
1783 int otr_resource_id = IDR_OTR_ICON; | |
1784 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { | |
1785 if (IsFullscreen()) | |
1786 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; | |
1787 #if defined(OS_WIN) | |
1788 if (base::win::GetMetroModule() != NULL) | |
1789 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; | |
1790 #endif | |
1791 } | |
1792 | |
1793 return otr_resource_id; | |
1794 } | |
1795 | |
1782 views::LayoutManager* BrowserView::CreateLayoutManager() const { | 1796 views::LayoutManager* BrowserView::CreateLayoutManager() const { |
1783 return new BrowserViewLayout; | 1797 return new BrowserViewLayout; |
1784 } | 1798 } |
1785 | 1799 |
1786 ToolbarView* BrowserView::CreateToolbar() const { | 1800 ToolbarView* BrowserView::CreateToolbar() const { |
1787 return new ToolbarView(browser_.get()); | 1801 return new ToolbarView(browser_.get()); |
1788 } | 1802 } |
1789 | 1803 |
1790 void BrowserView::Init() { | 1804 void BrowserView::Init() { |
1791 GetWidget()->AddObserver(this); | 1805 GetWidget()->AddObserver(this); |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2429 this, | 2443 this, |
2430 web_contents->GetRenderViewHost(), | 2444 web_contents->GetRenderViewHost(), |
2431 password_generator, | 2445 password_generator, |
2432 browser_.get(), | 2446 browser_.get(), |
2433 wrapper->password_manager()); | 2447 wrapper->password_manager()); |
2434 | 2448 |
2435 views::BubbleDelegateView::CreateBubble(bubble); | 2449 views::BubbleDelegateView::CreateBubble(bubble); |
2436 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2450 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
2437 bubble->Show(); | 2451 bubble->Show(); |
2438 } | 2452 } |
OLD | NEW |