Chromium Code Reviews| 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/chromeos/frame/panel_browser_view.h" | 5 #include "chrome/browser/chromeos/frame/panel_browser_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/frame/browser_view.h" | 7 #include "chrome/browser/chromeos/frame/browser_view.h" |
| 8 #include "chrome/browser/chromeos/frame/panel_controller.h" | 8 #include "chrome/browser/chromeos/frame/panel_controller.h" |
| 9 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" | 9 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" |
| 10 #include "views/widget/widget.h" | 10 #include "views/widget/widget.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 : BrowserView(browser), | 26 : BrowserView(browser), |
| 27 creator_xid_(0) { | 27 creator_xid_(0) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 PanelBrowserView::~PanelBrowserView() {} | 30 PanelBrowserView::~PanelBrowserView() {} |
| 31 | 31 |
| 32 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
| 33 // PanelBrowserView functions | 33 // PanelBrowserView functions |
| 34 | 34 |
| 35 void PanelBrowserView::LimitBounds(gfx::Rect* bounds) const { | 35 void PanelBrowserView::LimitBounds(gfx::Rect* bounds) const { |
| 36 #if defined(USE_AURA) | |
| 37 // TODO(saintlou): Need PureViews panels? | |
|
oshima
2011/09/19 15:52:39
On chromeos, this will be controlled by WM so this
Emmanuel Saint-loubert-Bié
2011/09/19 20:15:36
Done.
| |
| 38 bounds->set_width(kPanelDefaultWidthPixels); | |
| 39 bounds->set_height(kPanelDefaultHeightPixels); | |
| 40 #else | |
| 36 GdkScreen* screen = gtk_widget_get_screen(GetWidget()->GetNativeView()); | 41 GdkScreen* screen = gtk_widget_get_screen(GetWidget()->GetNativeView()); |
| 37 int max_width = gdk_screen_get_width(screen) * kPanelMaxWidthFactor; | 42 int max_width = gdk_screen_get_width(screen) * kPanelMaxWidthFactor; |
| 38 int max_height = gdk_screen_get_height(screen) * kPanelMaxHeightFactor; | 43 int max_height = gdk_screen_get_height(screen) * kPanelMaxHeightFactor; |
| 39 | 44 |
| 40 if (bounds->width() == 0 && bounds->height() == 0) { | 45 if (bounds->width() == 0 && bounds->height() == 0) { |
| 41 bounds->set_width(kPanelDefaultWidthPixels); | 46 bounds->set_width(kPanelDefaultWidthPixels); |
| 42 bounds->set_height(kPanelDefaultHeightPixels); | 47 bounds->set_height(kPanelDefaultHeightPixels); |
| 43 } | 48 } |
| 44 | 49 |
| 45 if (bounds->width() < kPanelMinWidthPixels) | 50 if (bounds->width() < kPanelMinWidthPixels) |
| 46 bounds->set_width(kPanelMinWidthPixels); | 51 bounds->set_width(kPanelMinWidthPixels); |
| 47 else if (bounds->width() > max_width) | 52 else if (bounds->width() > max_width) |
| 48 bounds->set_width(max_width); | 53 bounds->set_width(max_width); |
| 49 | 54 |
| 50 if (bounds->height() < kPanelMinHeightPixels) | 55 if (bounds->height() < kPanelMinHeightPixels) |
| 51 bounds->set_height(kPanelMinHeightPixels); | 56 bounds->set_height(kPanelMinHeightPixels); |
| 52 else if (bounds->height() > max_height) | 57 else if (bounds->height() > max_height) |
| 53 bounds->set_height(max_height); | 58 bounds->set_height(max_height); |
| 59 #endif | |
| 54 } | 60 } |
| 55 | 61 |
| 56 | 62 |
| 57 //////////////////////////////////////////////////////////////////////////////// | 63 //////////////////////////////////////////////////////////////////////////////// |
| 58 // BrowserView overrides. | 64 // BrowserView overrides. |
| 59 | 65 |
| 60 void PanelBrowserView::Show() { | 66 void PanelBrowserView::Show() { |
| 61 InitPanelController(true); // focus when opened | 67 InitPanelController(true); // focus when opened |
| 62 ::BrowserView::Show(); | 68 ::BrowserView::Show(); |
| 63 } | 69 } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 94 } | 100 } |
| 95 | 101 |
| 96 void PanelBrowserView::UpdateTitleBar() { | 102 void PanelBrowserView::UpdateTitleBar() { |
| 97 ::BrowserView::UpdateTitleBar(); | 103 ::BrowserView::UpdateTitleBar(); |
| 98 if (panel_controller_.get()) | 104 if (panel_controller_.get()) |
| 99 panel_controller_->UpdateTitleBar(); | 105 panel_controller_->UpdateTitleBar(); |
| 100 } | 106 } |
| 101 | 107 |
| 102 void PanelBrowserView::SetCreatorView(PanelBrowserView* creator) { | 108 void PanelBrowserView::SetCreatorView(PanelBrowserView* creator) { |
| 103 DCHECK(creator); | 109 DCHECK(creator); |
| 110 #if defined(USE_AURA) | |
| 111 // TODO(saintlou): Need PureViews | |
| 112 #else | |
| 104 GtkWindow* window = creator->GetNativeHandle(); | 113 GtkWindow* window = creator->GetNativeHandle(); |
| 105 creator_xid_ = ui::GetX11WindowFromGtkWidget(GTK_WIDGET(window)); | 114 creator_xid_ = ui::GetX11WindowFromGtkWidget(GTK_WIDGET(window)); |
| 115 #endif | |
| 106 } | 116 } |
| 107 | 117 |
| 108 WindowOpenDisposition PanelBrowserView::GetDispositionForPopupBounds( | 118 WindowOpenDisposition PanelBrowserView::GetDispositionForPopupBounds( |
| 109 const gfx::Rect& bounds) { | 119 const gfx::Rect& bounds) { |
| 110 return chromeos::BrowserView::DispositionForPopupBounds(bounds); | 120 return chromeos::BrowserView::DispositionForPopupBounds(bounds); |
| 111 } | 121 } |
| 112 | 122 |
| 113 bool PanelBrowserView::GetSavedWindowPlacement( | 123 bool PanelBrowserView::GetSavedWindowPlacement( |
| 114 gfx::Rect* bounds, | 124 gfx::Rect* bounds, |
| 115 ui::WindowShowState* show_state) const { | 125 ui::WindowShowState* show_state) const { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 | 173 |
| 164 void PanelBrowserView::ClosePanel() { | 174 void PanelBrowserView::ClosePanel() { |
| 165 Close(); | 175 Close(); |
| 166 } | 176 } |
| 167 | 177 |
| 168 void PanelBrowserView::ActivatePanel() { | 178 void PanelBrowserView::ActivatePanel() { |
| 169 Activate(); | 179 Activate(); |
| 170 } | 180 } |
| 171 | 181 |
| 172 } // namespace chromeos | 182 } // namespace chromeos |
| OLD | NEW |