Chromium Code Reviews| Index: chrome/browser/ui/panels/panel_browser_view.cc |
| diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc |
| index 748a4897c69915fe2417fe32322c4a6d91cc37f4..ddb06eb85ab7cc61b9d131a19a7085daa9a52326 100644 |
| --- a/chrome/browser/ui/panels/panel_browser_view.cc |
| +++ b/chrome/browser/ui/panels/panel_browser_view.cc |
| @@ -309,10 +309,6 @@ void PanelBrowserView::DestroyPanelBrowser() { |
| DestroyBrowser(); |
| } |
| -NativePanelTesting* PanelBrowserView::GetNativePanelTesting() { |
| - return this; |
| -} |
| - |
| PanelBrowserFrameView* PanelBrowserView::GetFrameView() const { |
| return static_cast<PanelBrowserFrameView*>(frame()->GetFrameView()); |
| } |
| @@ -377,3 +373,57 @@ bool PanelBrowserView::EndDragging(bool cancelled) { |
| panel_->manager()->EndDragging(cancelled); |
| return true; |
| } |
| + |
| +// NativePanelTesting implementation. |
| +class NativePanelTestingWin : public NativePanelTesting { |
| + public: |
| + explicit NativePanelTestingWin(PanelBrowserView* panel_browser_view); |
| + |
| + private: |
| + virtual void TitlebarLeftButtonPress(gfx::Point point) OVERRIDE; |
| + virtual void TitlebarLeftButtonRelease() OVERRIDE; |
| + virtual void TitlebarDrag(int delta_x, int delta_y) OVERRIDE; |
| + virtual void TitlebarCancelDrag() OVERRIDE; |
| + virtual void TitlebarFinishDrag() OVERRIDE; |
| + |
| + PanelBrowserView* panel_browser_view_; |
| +}; |
| + |
| +NativePanelTesting* NativePanelTesting::Create(NativePanel* native_panel) { |
| + return new NativePanelTestingWin(static_cast<PanelBrowserView*>( |
| + native_panel)); |
| +} |
| + |
| +NativePanelTestingWin::NativePanelTestingWin( |
| + PanelBrowserView* panel_browser_view) : |
| + panel_browser_view_(panel_browser_view) { |
| +} |
| + |
| +void NativePanelTestingWin::TitlebarLeftButtonPress(gfx::Point point) { |
| + views::MouseEvent pressed(ui::ET_MOUSE_PRESSED, point.x(), point.y(), |
| + ui::EF_LEFT_BUTTON_DOWN); |
| + panel_browser_view_->OnTitleBarMousePressed(pressed); |
|
jianli
2011/08/09 21:10:23
It seems to me that we can refactor PanelBrowserVi
prasadt
2011/08/09 23:05:04
Wouldn't it be better to leave it the way it is in
jianli
2011/08/09 23:24:16
I rather worry about it later since it is more imp
prasadt
2011/08/09 23:49:41
I started making the change and then saw that you'
prasadt
2011/08/11 00:26:41
Made the changes following our offline chat. Plea
|
| +} |
| + |
| +void NativePanelTestingWin::TitlebarLeftButtonRelease() { |
| + views::MouseEvent released(ui::ET_MOUSE_RELEASED, 0, 0, 0); |
| + panel_browser_view_->OnTitleBarMouseReleased(released); |
| +} |
| + |
| +void NativePanelTestingWin::TitlebarDrag(int delta_x, int delta_y) { |
| + gfx::Rect current_bounds = panel_browser_view_->GetRestoredBounds(); |
| + views::MouseEvent dragged(ui::ET_MOUSE_DRAGGED, |
| + current_bounds.x() + delta_x, |
| + current_bounds.y() + delta_y, |
| + ui::EF_LEFT_BUTTON_DOWN); |
| + panel_browser_view_->OnTitleBarMouseDragged(dragged); |
| +} |
| + |
| +void NativePanelTestingWin::TitlebarCancelDrag() { |
| + panel_browser_view_->OnTitleBarMouseCaptureLost(); |
| +} |
| + |
| +void NativePanelTestingWin::TitlebarFinishDrag() { |
| + views::MouseEvent released(ui::ET_MOUSE_RELEASED, 0, 0, 0); |
| + panel_browser_view_->OnTitleBarMouseReleased(released); |
| +} |