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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 #if defined(USE_ASH) | 104 #if defined(USE_ASH) |
105 #include "ash/launcher/launcher.h" | 105 #include "ash/launcher/launcher.h" |
106 #include "ash/launcher/launcher_model.h" | 106 #include "ash/launcher/launcher_model.h" |
107 #include "ash/shell.h" | 107 #include "ash/shell.h" |
108 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" | 108 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" |
109 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.
h" | 109 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.
h" |
110 #include "chrome/browser/ui/views/ash/window_positioner.h" | 110 #include "chrome/browser/ui/views/ash/window_positioner.h" |
111 #elif defined(OS_WIN) && !defined(USE_AURA) | 111 #elif defined(OS_WIN) && !defined(USE_AURA) |
112 #include "base/win/metro.h" | 112 #include "base/win/metro.h" |
113 #include "chrome/browser/aeropeek_manager.h" | |
114 #include "chrome/browser/jumplist_win.h" | 113 #include "chrome/browser/jumplist_win.h" |
115 #include "ui/views/widget/native_widget_win.h" | 114 #include "ui/views/widget/native_widget_win.h" |
116 #endif | 115 #endif |
117 | 116 |
118 #if defined(USE_AURA) | 117 #if defined(USE_AURA) |
119 #include "chrome/browser/ui/views/accelerator_table.h" | 118 #include "chrome/browser/ui/views/accelerator_table.h" |
120 #include "ui/gfx/screen.h" | 119 #include "ui/gfx/screen.h" |
121 #endif | 120 #endif |
122 | 121 |
123 #if defined(OS_CHROMEOS) | 122 #if defined(OS_CHROMEOS) |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 BrowserView::~BrowserView() { | 354 BrowserView::~BrowserView() { |
356 #if defined(USE_ASH) | 355 #if defined(USE_ASH) |
357 // Destroy BrowserLauncherItemController early on as it listens to the | 356 // Destroy BrowserLauncherItemController early on as it listens to the |
358 // TabstripModel, which is destroyed by the browser. | 357 // TabstripModel, which is destroyed by the browser. |
359 launcher_item_controller_.reset(); | 358 launcher_item_controller_.reset(); |
360 #endif | 359 #endif |
361 | 360 |
362 browser_->tabstrip_model()->RemoveObserver(this); | 361 browser_->tabstrip_model()->RemoveObserver(this); |
363 | 362 |
364 #if defined(OS_WIN) && !defined(USE_AURA) | 363 #if defined(OS_WIN) && !defined(USE_AURA) |
365 // Remove this observer. | |
366 if (aeropeek_manager_.get()) | |
367 browser_->tabstrip_model()->RemoveObserver(aeropeek_manager_.get()); | |
368 | |
369 // Stop hung plugin monitoring. | 364 // Stop hung plugin monitoring. |
370 ticker_.Stop(); | 365 ticker_.Stop(); |
371 ticker_.UnregisterTickHandler(&hung_window_detector_); | 366 ticker_.UnregisterTickHandler(&hung_window_detector_); |
372 | 367 |
373 // Terminate the jumplist (must be called before browser_->profile() is | 368 // Terminate the jumplist (must be called before browser_->profile() is |
374 // destroyed. | 369 // destroyed. |
375 if (jumplist_) { | 370 if (jumplist_) { |
376 jumplist_->Terminate(); | 371 jumplist_->Terminate(); |
377 } | 372 } |
378 #endif | 373 #endif |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 return kViewClassName; | 1723 return kViewClassName; |
1729 } | 1724 } |
1730 | 1725 |
1731 void BrowserView::Layout() { | 1726 void BrowserView::Layout() { |
1732 if (ignore_layout_) | 1727 if (ignore_layout_) |
1733 return; | 1728 return; |
1734 views::View::Layout(); | 1729 views::View::Layout(); |
1735 | 1730 |
1736 // The status bubble position requires that all other layout finish first. | 1731 // The status bubble position requires that all other layout finish first. |
1737 LayoutStatusBubble(); | 1732 LayoutStatusBubble(); |
1738 | |
1739 #if defined(OS_WIN) && !defined(USE_AURA) | |
1740 // Send the margins of the "user-perceived content area" of this | |
1741 // browser window so AeroPeekManager can render a background-tab image in | |
1742 // the area. | |
1743 // TODO(pkasting) correct content inset?? | |
1744 if (aeropeek_manager_.get()) { | |
1745 gfx::Insets insets(GetFindBarBoundingBox().y() + 1, | |
1746 0, | |
1747 0, | |
1748 0); | |
1749 aeropeek_manager_->SetContentInsets(insets); | |
1750 } | |
1751 #endif | |
1752 } | 1733 } |
1753 | 1734 |
1754 void BrowserView::PaintChildren(gfx::Canvas* canvas) { | 1735 void BrowserView::PaintChildren(gfx::Canvas* canvas) { |
1755 // Paint the |infobar_container_| last so that it may paint its | 1736 // Paint the |infobar_container_| last so that it may paint its |
1756 // overlapping tabs. | 1737 // overlapping tabs. |
1757 for (int i = 0; i < child_count(); ++i) { | 1738 for (int i = 0; i < child_count(); ++i) { |
1758 View* child = child_at(i); | 1739 View* child = child_at(i); |
1759 if (child != infobar_container_) | 1740 if (child != infobar_container_) |
1760 child->Paint(canvas); | 1741 child->Paint(canvas); |
1761 } | 1742 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1889 status_bubble_.reset(new StatusBubbleViews(contents_)); | 1870 status_bubble_.reset(new StatusBubbleViews(contents_)); |
1890 #endif | 1871 #endif |
1891 | 1872 |
1892 #if defined(OS_WIN) && !defined(USE_AURA) | 1873 #if defined(OS_WIN) && !defined(USE_AURA) |
1893 // Create a custom JumpList and add it to an observer of TabRestoreService | 1874 // Create a custom JumpList and add it to an observer of TabRestoreService |
1894 // so we can update the custom JumpList when a tab is added or removed. | 1875 // so we can update the custom JumpList when a tab is added or removed. |
1895 if (JumpList::Enabled()) { | 1876 if (JumpList::Enabled()) { |
1896 jumplist_ = new JumpList(); | 1877 jumplist_ = new JumpList(); |
1897 jumplist_->AddObserver(browser_->profile()); | 1878 jumplist_->AddObserver(browser_->profile()); |
1898 } | 1879 } |
1899 | |
1900 if (AeroPeekManager::Enabled()) { | |
1901 aeropeek_manager_.reset(new AeroPeekManager( | |
1902 frame_->GetNativeWindow())); | |
1903 browser_->tabstrip_model()->AddObserver(aeropeek_manager_.get()); | |
1904 } | |
1905 #endif | 1880 #endif |
1906 | 1881 |
1907 // We're now initialized and ready to process Layout requests. | 1882 // We're now initialized and ready to process Layout requests. |
1908 ignore_layout_ = false; | 1883 ignore_layout_ = false; |
1909 } | 1884 } |
1910 | 1885 |
1911 void BrowserView::LoadingAnimationCallback() { | 1886 void BrowserView::LoadingAnimationCallback() { |
1912 base::TimeTicks now = base::TimeTicks::Now(); | 1887 base::TimeTicks now = base::TimeTicks::Now(); |
1913 if (!last_animation_time_.is_null()) { | 1888 if (!last_animation_time_.is_null()) { |
1914 UMA_HISTOGRAM_TIMES( | 1889 UMA_HISTOGRAM_TIMES( |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2469 return; | 2444 return; |
2470 | 2445 |
2471 PasswordGenerationBubbleView* bubble = | 2446 PasswordGenerationBubbleView* bubble = |
2472 new PasswordGenerationBubbleView(bounds, | 2447 new PasswordGenerationBubbleView(bounds, |
2473 this, | 2448 this, |
2474 web_contents->GetRenderViewHost()); | 2449 web_contents->GetRenderViewHost()); |
2475 views::BubbleDelegateView::CreateBubble(bubble); | 2450 views::BubbleDelegateView::CreateBubble(bubble); |
2476 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2451 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
2477 bubble->Show(); | 2452 bubble->Show(); |
2478 } | 2453 } |
OLD | NEW |