OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 #include "views/widget/root_view.h" | 105 #include "views/widget/root_view.h" |
106 #include "views/widget/widget.h" | 106 #include "views/widget/widget.h" |
107 | 107 |
108 #if defined(USE_AURA) | 108 #if defined(USE_AURA) |
109 #include "chrome/browser/ui/views/accelerator_table.h" | 109 #include "chrome/browser/ui/views/accelerator_table.h" |
110 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" | 110 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
111 #include "chrome/browser/ui/views/aura/launcher_icon_updater.h" | 111 #include "chrome/browser/ui/views/aura/launcher_icon_updater.h" |
112 #include "ui/aura_shell/launcher/launcher.h" | 112 #include "ui/aura_shell/launcher/launcher.h" |
113 #include "ui/aura_shell/launcher/launcher_model.h" | 113 #include "ui/aura_shell/launcher/launcher_model.h" |
114 #include "ui/aura_shell/shell.h" | 114 #include "ui/aura_shell/shell.h" |
| 115 #include "ui/gfx/screen.h" |
115 #elif defined(OS_WIN) | 116 #elif defined(OS_WIN) |
116 #include "chrome/browser/aeropeek_manager.h" | 117 #include "chrome/browser/aeropeek_manager.h" |
117 #include "chrome/browser/jumplist_win.h" | 118 #include "chrome/browser/jumplist_win.h" |
118 #include "ui/base/message_box_win.h" | 119 #include "ui/base/message_box_win.h" |
119 #include "views/widget/native_widget_win.h" | 120 #include "views/widget/native_widget_win.h" |
120 #elif defined(TOOLKIT_USES_GTK) | 121 #elif defined(TOOLKIT_USES_GTK) |
121 #include "chrome/browser/ui/views/accelerator_table.h" | 122 #include "chrome/browser/ui/views/accelerator_table.h" |
122 #if !defined(TOUCH_UI) | 123 #if !defined(TOUCH_UI) |
123 #include "chrome/browser/ui/views/handle_web_keyboard_event.h" | 124 #include "chrome/browser/ui/views/handle_web_keyboard_event.h" |
124 #endif | 125 #endif |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 delete preview_container_; | 1286 delete preview_container_; |
1286 preview_container_ = NULL; | 1287 preview_container_ = NULL; |
1287 } | 1288 } |
1288 | 1289 |
1289 gfx::Rect BrowserView::GetInstantBounds() { | 1290 gfx::Rect BrowserView::GetInstantBounds() { |
1290 return contents_->GetPreviewBounds(); | 1291 return contents_->GetPreviewBounds(); |
1291 } | 1292 } |
1292 | 1293 |
1293 WindowOpenDisposition BrowserView::GetDispositionForPopupBounds( | 1294 WindowOpenDisposition BrowserView::GetDispositionForPopupBounds( |
1294 const gfx::Rect& bounds) { | 1295 const gfx::Rect& bounds) { |
| 1296 #if defined(USE_AURA) && defined(OS_CHROMEOS) |
| 1297 // If a popup is larger than a given fraction of the screen, turn it into |
| 1298 // a foreground tab. Also check for width or height == 0, which would |
| 1299 // indicate a tab sized popup window. |
| 1300 gfx::Size size = gfx::Screen::GetMonitorAreaNearestWindow( |
| 1301 GetWidget()->GetNativeView()).size(); |
| 1302 if (bounds.width() > size.width() || |
| 1303 bounds.width() == 0 || |
| 1304 bounds.height() > size.height() || |
| 1305 bounds.height() == 0) { |
| 1306 return NEW_FOREGROUND_TAB; |
| 1307 } |
| 1308 #endif |
1295 return NEW_POPUP; | 1309 return NEW_POPUP; |
1296 } | 1310 } |
1297 | 1311 |
1298 FindBar* BrowserView::CreateFindBar() { | 1312 FindBar* BrowserView::CreateFindBar() { |
1299 return browser::CreateFindBar(this); | 1313 return browser::CreateFindBar(this); |
1300 } | 1314 } |
1301 | 1315 |
1302 #if defined(OS_CHROMEOS) | 1316 #if defined(OS_CHROMEOS) |
1303 void BrowserView::ShowMobileSetup() { | 1317 void BrowserView::ShowMobileSetup() { |
1304 MobileSetupDialog::Show(); | 1318 MobileSetupDialog::Show(); |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2604 Bubble::Show(this->GetWidget(), bounds, views::BubbleBorder::TOP_RIGHT, | 2618 Bubble::Show(this->GetWidget(), bounds, views::BubbleBorder::TOP_RIGHT, |
2605 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, | 2619 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, |
2606 bubble_view, bubble_view); | 2620 bubble_view, bubble_view); |
2607 } | 2621 } |
2608 | 2622 |
2609 void BrowserView::ShowAvatarBubbleFromAvatarButton() { | 2623 void BrowserView::ShowAvatarBubbleFromAvatarButton() { |
2610 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | 2624 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); |
2611 if (button) | 2625 if (button) |
2612 button->ShowAvatarBubble(); | 2626 button->ShowAvatarBubble(); |
2613 } | 2627 } |
OLD | NEW |