OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/panel_controller.h" | 7 #include "chrome/browser/chromeos/frame/panel_controller.h" |
8 #include "cros/chromeos_wm_ipc_enums.h" | 8 #include "cros/chromeos_wm_ipc_enums.h" |
9 #include "views/widget/widget.h" | 9 #include "views/widget/widget.h" |
10 #include "views/window/window.h" | 10 #include "views/window/window.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 if (bounds->height() < kPanelMinHeightPixels) | 48 if (bounds->height() < kPanelMinHeightPixels) |
49 bounds->set_height(kPanelMinHeightPixels); | 49 bounds->set_height(kPanelMinHeightPixels); |
50 else if (bounds->height() > max_height) | 50 else if (bounds->height() > max_height) |
51 bounds->set_height(max_height); | 51 bounds->set_height(max_height); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 //////////////////////////////////////////////////////////////////////////////// | 55 //////////////////////////////////////////////////////////////////////////////// |
56 // BrowserView overrides. | 56 // BrowserView overrides. |
57 | 57 |
58 void PanelBrowserView::Init() { | |
59 ::BrowserView::Init(); | |
60 // The visibility of toolbar is controlled in | |
61 // the BrowserView::IsToolbarVisible method. | |
62 | |
63 views::Window* window = frame()->GetWindow(); | |
64 gfx::NativeWindow native_window = window->GetNativeWindow(); | |
65 // The window manager needs the min size for popups. | |
66 gfx::Rect bounds = window->GetBounds(); | |
67 LimitBounds(&bounds); | |
68 gtk_widget_set_size_request( | |
69 GTK_WIDGET(native_window), bounds.width(), bounds.height()); | |
70 // If we don't explicitly resize here there is a race condition between | |
71 // the X Server and the window manager. Windows will appear with a default | |
72 // size of 200x200 if this happens. | |
73 gtk_window_resize(native_window, bounds.width(), bounds.height()); | |
74 } | |
75 | |
76 void PanelBrowserView::Show() { | 58 void PanelBrowserView::Show() { |
77 if (panel_controller_.get() == NULL) { | 59 if (panel_controller_.get() == NULL) { |
78 panel_controller_.reset(new PanelController(this, GetNativeHandle())); | 60 panel_controller_.reset(new PanelController(this, GetNativeHandle())); |
79 panel_controller_->Init( | 61 panel_controller_->Init( |
80 true /* focus when opened */, bounds(), creator_xid_, | 62 true /* focus when opened */, bounds(), creator_xid_, |
81 WM_IPC_PANEL_USER_RESIZE_HORIZONTALLY_AND_VERTICALLY); | 63 WM_IPC_PANEL_USER_RESIZE_HORIZONTALLY_AND_VERTICALLY); |
82 } | 64 } |
83 ::BrowserView::Show(); | 65 ::BrowserView::Show(); |
84 } | 66 } |
85 | 67 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 115 |
134 SkBitmap PanelBrowserView::GetPanelIcon() { | 116 SkBitmap PanelBrowserView::GetPanelIcon() { |
135 return browser()->GetCurrentPageIcon(); | 117 return browser()->GetCurrentPageIcon(); |
136 } | 118 } |
137 | 119 |
138 void PanelBrowserView::ClosePanel() { | 120 void PanelBrowserView::ClosePanel() { |
139 Close(); | 121 Close(); |
140 } | 122 } |
141 | 123 |
142 } // namespace chromeos | 124 } // namespace chromeos |
OLD | NEW |