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 | |
38 #else | |
39 GdkScreen* screen = gtk_widget_get_screen(GetWidget()->GetNativeView()); | 36 GdkScreen* screen = gtk_widget_get_screen(GetWidget()->GetNativeView()); |
40 int max_width = gdk_screen_get_width(screen) * kPanelMaxWidthFactor; | 37 int max_width = gdk_screen_get_width(screen) * kPanelMaxWidthFactor; |
41 int max_height = gdk_screen_get_height(screen) * kPanelMaxHeightFactor; | 38 int max_height = gdk_screen_get_height(screen) * kPanelMaxHeightFactor; |
42 | 39 |
43 if (bounds->width() == 0 && bounds->height() == 0) { | 40 if (bounds->width() == 0 && bounds->height() == 0) { |
44 bounds->set_width(kPanelDefaultWidthPixels); | 41 bounds->set_width(kPanelDefaultWidthPixels); |
45 bounds->set_height(kPanelDefaultHeightPixels); | 42 bounds->set_height(kPanelDefaultHeightPixels); |
46 } | 43 } |
47 | 44 |
48 if (bounds->width() < kPanelMinWidthPixels) | 45 if (bounds->width() < kPanelMinWidthPixels) |
49 bounds->set_width(kPanelMinWidthPixels); | 46 bounds->set_width(kPanelMinWidthPixels); |
50 else if (bounds->width() > max_width) | 47 else if (bounds->width() > max_width) |
51 bounds->set_width(max_width); | 48 bounds->set_width(max_width); |
52 | 49 |
53 if (bounds->height() < kPanelMinHeightPixels) | 50 if (bounds->height() < kPanelMinHeightPixels) |
54 bounds->set_height(kPanelMinHeightPixels); | 51 bounds->set_height(kPanelMinHeightPixels); |
55 else if (bounds->height() > max_height) | 52 else if (bounds->height() > max_height) |
56 bounds->set_height(max_height); | 53 bounds->set_height(max_height); |
57 #endif | |
58 } | 54 } |
59 | 55 |
60 | 56 |
61 //////////////////////////////////////////////////////////////////////////////// | 57 //////////////////////////////////////////////////////////////////////////////// |
62 // BrowserView overrides. | 58 // BrowserView overrides. |
63 | 59 |
64 void PanelBrowserView::Show() { | 60 void PanelBrowserView::Show() { |
65 InitPanelController(true); // focus when opened | 61 InitPanelController(true); // focus when opened |
66 ::BrowserView::Show(); | 62 ::BrowserView::Show(); |
67 } | 63 } |
(...skipping 30 matching lines...) Expand all Loading... |
98 } | 94 } |
99 | 95 |
100 void PanelBrowserView::UpdateTitleBar() { | 96 void PanelBrowserView::UpdateTitleBar() { |
101 ::BrowserView::UpdateTitleBar(); | 97 ::BrowserView::UpdateTitleBar(); |
102 if (panel_controller_.get()) | 98 if (panel_controller_.get()) |
103 panel_controller_->UpdateTitleBar(); | 99 panel_controller_->UpdateTitleBar(); |
104 } | 100 } |
105 | 101 |
106 void PanelBrowserView::SetCreatorView(PanelBrowserView* creator) { | 102 void PanelBrowserView::SetCreatorView(PanelBrowserView* creator) { |
107 DCHECK(creator); | 103 DCHECK(creator); |
108 #if defined(USE_AURA) | |
109 // TODO(saintlou): Need PureViews | |
110 #else | |
111 GtkWindow* window = creator->GetNativeHandle(); | 104 GtkWindow* window = creator->GetNativeHandle(); |
112 creator_xid_ = ui::GetX11WindowFromGtkWidget(GTK_WIDGET(window)); | 105 creator_xid_ = ui::GetX11WindowFromGtkWidget(GTK_WIDGET(window)); |
113 #endif | |
114 } | 106 } |
115 | 107 |
116 WindowOpenDisposition PanelBrowserView::GetDispositionForPopupBounds( | 108 WindowOpenDisposition PanelBrowserView::GetDispositionForPopupBounds( |
117 const gfx::Rect& bounds) { | 109 const gfx::Rect& bounds) { |
118 return chromeos::BrowserView::DispositionForPopupBounds(bounds); | 110 return chromeos::BrowserView::DispositionForPopupBounds(bounds); |
119 } | 111 } |
120 | 112 |
121 bool PanelBrowserView::GetSavedWindowPlacement( | 113 bool PanelBrowserView::GetSavedWindowPlacement( |
122 gfx::Rect* bounds, | 114 gfx::Rect* bounds, |
123 ui::WindowShowState* show_state) const { | 115 ui::WindowShowState* show_state) const { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 163 |
172 void PanelBrowserView::ClosePanel() { | 164 void PanelBrowserView::ClosePanel() { |
173 Close(); | 165 Close(); |
174 } | 166 } |
175 | 167 |
176 void PanelBrowserView::ActivatePanel() { | 168 void PanelBrowserView::ActivatePanel() { |
177 Activate(); | 169 Activate(); |
178 } | 170 } |
179 | 171 |
180 } // namespace chromeos | 172 } // namespace chromeos |
OLD | NEW |