Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: chrome/browser/ui/panels/panel_browser_view.cc

Issue 7605009: Implement drag and drop testing in a platform independent way. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review feedback and build bot errors for windows. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..777a0f7d9472f2534575543840a6b87380529d12 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 PressLeftMouseButtonTitlebar(gfx::Point point) OVERRIDE;
+ virtual void ReleaseMouseButtonTitlebar() OVERRIDE;
+ virtual void DragTitlebar(int delta_x, int delta_y) OVERRIDE;
+ virtual void CancelDragTitlebar() OVERRIDE;
+ virtual void FinishDragTitlebar() 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::PressLeftMouseButtonTitlebar(gfx::Point point) {
+ views::MouseEvent pressed(ui::ET_MOUSE_PRESSED, point.x(), point.y(),
+ ui::EF_LEFT_BUTTON_DOWN);
+ panel_browser_view_->OnTitleBarMousePressed(pressed);
+}
+
+void NativePanelTestingWin::ReleaseMouseButtonTitlebar() {
+ views::MouseEvent released(ui::ET_MOUSE_RELEASED, 0, 0, 0);
+ panel_browser_view_->OnTitleBarMouseReleased(released);
+}
+
+void NativePanelTestingWin::DragTitlebar(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::CancelDragTitlebar() {
+ panel_browser_view_->OnTitleBarMouseCaptureLost();
+}
+
+void NativePanelTestingWin::FinishDragTitlebar() {
+ views::MouseEvent released(ui::ET_MOUSE_RELEASED, 0, 0, 0);
+ panel_browser_view_->OnTitleBarMouseReleased(released);
+}

Powered by Google App Engine
This is Rietveld 408576698