 Chromium Code Reviews
 Chromium Code Reviews Issue 7945014:
  Applied review comments from oshima for CL 7850026.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 7945014:
  Applied review comments from oshima for CL 7850026.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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? | |
| 38 bounds->set_width(kPanelDefaultWidthPixels); | |
| 39 bounds->set_height(kPanelDefaultHeightPixels); | |
| 40 #else | |
| 41 GdkScreen* screen = gtk_widget_get_screen(GetWidget()->GetNativeView()); | 36 GdkScreen* screen = gtk_widget_get_screen(GetWidget()->GetNativeView()); | 
| 
oshima
2011/09/19 22:31:03
What I meant was that you could comment out the en
 
Emmanuel Saint-loubert-Bié
2011/09/19 23:26:02
Done.
 | |
| 42 int max_width = gdk_screen_get_width(screen) * kPanelMaxWidthFactor; | 37 int max_width = gdk_screen_get_width(screen) * kPanelMaxWidthFactor; | 
| 43 int max_height = gdk_screen_get_height(screen) * kPanelMaxHeightFactor; | 38 int max_height = gdk_screen_get_height(screen) * kPanelMaxHeightFactor; | 
| 44 | 39 | 
| 45 if (bounds->width() == 0 && bounds->height() == 0) { | 40 if (bounds->width() == 0 && bounds->height() == 0) { | 
| 46 bounds->set_width(kPanelDefaultWidthPixels); | 41 bounds->set_width(kPanelDefaultWidthPixels); | 
| 47 bounds->set_height(kPanelDefaultHeightPixels); | 42 bounds->set_height(kPanelDefaultHeightPixels); | 
| 48 } | 43 } | 
| 49 | 44 | 
| 50 if (bounds->width() < kPanelMinWidthPixels) | 45 if (bounds->width() < kPanelMinWidthPixels) | 
| 51 bounds->set_width(kPanelMinWidthPixels); | 46 bounds->set_width(kPanelMinWidthPixels); | 
| 52 else if (bounds->width() > max_width) | 47 else if (bounds->width() > max_width) | 
| 53 bounds->set_width(max_width); | 48 bounds->set_width(max_width); | 
| 54 | 49 | 
| 55 if (bounds->height() < kPanelMinHeightPixels) | 50 if (bounds->height() < kPanelMinHeightPixels) | 
| 56 bounds->set_height(kPanelMinHeightPixels); | 51 bounds->set_height(kPanelMinHeightPixels); | 
| 57 else if (bounds->height() > max_height) | 52 else if (bounds->height() > max_height) | 
| 58 bounds->set_height(max_height); | 53 bounds->set_height(max_height); | 
| 59 #endif | |
| 60 } | 54 } | 
| 61 | 55 | 
| 62 | 56 | 
| 63 //////////////////////////////////////////////////////////////////////////////// | 57 //////////////////////////////////////////////////////////////////////////////// | 
| 64 // BrowserView overrides. | 58 // BrowserView overrides. | 
| 65 | 59 | 
| 66 void PanelBrowserView::Show() { | 60 void PanelBrowserView::Show() { | 
| 67 InitPanelController(true); // focus when opened | 61 InitPanelController(true); // focus when opened | 
| 68 ::BrowserView::Show(); | 62 ::BrowserView::Show(); | 
| 69 } | 63 } | 
| (...skipping 30 matching lines...) Expand all Loading... | |
| 100 } | 94 } | 
| 101 | 95 | 
| 102 void PanelBrowserView::UpdateTitleBar() { | 96 void PanelBrowserView::UpdateTitleBar() { | 
| 103 ::BrowserView::UpdateTitleBar(); | 97 ::BrowserView::UpdateTitleBar(); | 
| 104 if (panel_controller_.get()) | 98 if (panel_controller_.get()) | 
| 105 panel_controller_->UpdateTitleBar(); | 99 panel_controller_->UpdateTitleBar(); | 
| 106 } | 100 } | 
| 107 | 101 | 
| 108 void PanelBrowserView::SetCreatorView(PanelBrowserView* creator) { | 102 void PanelBrowserView::SetCreatorView(PanelBrowserView* creator) { | 
| 109 DCHECK(creator); | 103 DCHECK(creator); | 
| 110 #if defined(USE_AURA) | |
| 111 // TODO(saintlou): Need PureViews | |
| 112 #else | |
| 
oshima
2011/09/19 22:31:03
keep this.
 
Emmanuel Saint-loubert-Bié
2011/09/19 23:26:02
Done.
 | |
| 113 GtkWindow* window = creator->GetNativeHandle(); | 104 GtkWindow* window = creator->GetNativeHandle(); | 
| 114 creator_xid_ = ui::GetX11WindowFromGtkWidget(GTK_WIDGET(window)); | 105 creator_xid_ = ui::GetX11WindowFromGtkWidget(GTK_WIDGET(window)); | 
| 115 #endif | |
| 116 } | 106 } | 
| 117 | 107 | 
| 118 WindowOpenDisposition PanelBrowserView::GetDispositionForPopupBounds( | 108 WindowOpenDisposition PanelBrowserView::GetDispositionForPopupBounds( | 
| 119 const gfx::Rect& bounds) { | 109 const gfx::Rect& bounds) { | 
| 120 return chromeos::BrowserView::DispositionForPopupBounds(bounds); | 110 return chromeos::BrowserView::DispositionForPopupBounds(bounds); | 
| 121 } | 111 } | 
| 122 | 112 | 
| 123 bool PanelBrowserView::GetSavedWindowPlacement( | 113 bool PanelBrowserView::GetSavedWindowPlacement( | 
| 124 gfx::Rect* bounds, | 114 gfx::Rect* bounds, | 
| 125 ui::WindowShowState* show_state) const { | 115 ui::WindowShowState* show_state) const { | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 | 163 | 
| 174 void PanelBrowserView::ClosePanel() { | 164 void PanelBrowserView::ClosePanel() { | 
| 175 Close(); | 165 Close(); | 
| 176 } | 166 } | 
| 177 | 167 | 
| 178 void PanelBrowserView::ActivatePanel() { | 168 void PanelBrowserView::ActivatePanel() { | 
| 179 Activate(); | 169 Activate(); | 
| 180 } | 170 } | 
| 181 | 171 | 
| 182 } // namespace chromeos | 172 } // namespace chromeos | 
| OLD | NEW |