| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 WebContentsDragWin(gfx::NativeWindow source_window, | 41 WebContentsDragWin(gfx::NativeWindow source_window, |
| 42 WebContents* web_contents, | 42 WebContents* web_contents, |
| 43 WebDragDest* drag_dest, | 43 WebDragDest* drag_dest, |
| 44 const base::Callback<void()>& drag_end_callback); | 44 const base::Callback<void()>& drag_end_callback); |
| 45 virtual ~WebContentsDragWin(); | 45 virtual ~WebContentsDragWin(); |
| 46 | 46 |
| 47 // Called on UI thread. | 47 // Called on UI thread. |
| 48 void StartDragging(const WebDropData& drop_data, | 48 void StartDragging(const WebDropData& drop_data, |
| 49 WebKit::WebDragOperationsMask ops, | 49 WebKit::WebDragOperationsMask ops, |
| 50 const gfx::ImageSkia& image, | 50 const gfx::ImageSkia& image, |
| 51 const gfx::Point& image_offset); | 51 const gfx::Vector2d& image_offset); |
| 52 void CancelDrag(); | 52 void CancelDrag(); |
| 53 | 53 |
| 54 // DataObjectImpl::Observer implementation. | 54 // DataObjectImpl::Observer implementation. |
| 55 // Called on drag-and-drop thread. | 55 // Called on drag-and-drop thread. |
| 56 virtual void OnWaitForData(); | 56 virtual void OnWaitForData(); |
| 57 virtual void OnDataObjectDisposed(); | 57 virtual void OnDataObjectDisposed(); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 // Called on either UI thread or drag-and-drop thread. | 60 // Called on either UI thread or drag-and-drop thread. |
| 61 void PrepareDragForDownload(const WebDropData& drop_data, | 61 void PrepareDragForDownload(const WebDropData& drop_data, |
| 62 ui::OSExchangeData* data, | 62 ui::OSExchangeData* data, |
| 63 const GURL& page_url, | 63 const GURL& page_url, |
| 64 const std::string& page_encoding); | 64 const std::string& page_encoding); |
| 65 void PrepareDragForFileContents(const WebDropData& drop_data, | 65 void PrepareDragForFileContents(const WebDropData& drop_data, |
| 66 ui::OSExchangeData* data); | 66 ui::OSExchangeData* data); |
| 67 void PrepareDragForUrl(const WebDropData& drop_data, | 67 void PrepareDragForUrl(const WebDropData& drop_data, |
| 68 ui::OSExchangeData* data); | 68 ui::OSExchangeData* data); |
| 69 // Returns false if the source window becomes invalid when the drag ends. | 69 // Returns false if the source window becomes invalid when the drag ends. |
| 70 // This could happen when the window gets destroyed when the drag is still in | 70 // This could happen when the window gets destroyed when the drag is still in |
| 71 // progress. No further processing should be done beyond this return point | 71 // progress. No further processing should be done beyond this return point |
| 72 // because the instance has been destroyed. | 72 // because the instance has been destroyed. |
| 73 bool DoDragging(const WebDropData& drop_data, | 73 bool DoDragging(const WebDropData& drop_data, |
| 74 WebKit::WebDragOperationsMask ops, | 74 WebKit::WebDragOperationsMask ops, |
| 75 const GURL& page_url, | 75 const GURL& page_url, |
| 76 const std::string& page_encoding, | 76 const std::string& page_encoding, |
| 77 const gfx::ImageSkia& image, | 77 const gfx::ImageSkia& image, |
| 78 const gfx::Point& image_offset); | 78 const gfx::Vector2d& image_offset); |
| 79 | 79 |
| 80 // Called on drag-and-drop thread. | 80 // Called on drag-and-drop thread. |
| 81 void StartBackgroundDragging(const WebDropData& drop_data, | 81 void StartBackgroundDragging(const WebDropData& drop_data, |
| 82 WebKit::WebDragOperationsMask ops, | 82 WebKit::WebDragOperationsMask ops, |
| 83 const GURL& page_url, | 83 const GURL& page_url, |
| 84 const std::string& page_encoding, | 84 const std::string& page_encoding, |
| 85 const gfx::ImageSkia& image, | 85 const gfx::ImageSkia& image, |
| 86 const gfx::Point& image_offset); | 86 const gfx::Vector2d& image_offset); |
| 87 // Called on UI thread. | 87 // Called on UI thread. |
| 88 void EndDragging(); | 88 void EndDragging(); |
| 89 void CloseThread(); | 89 void CloseThread(); |
| 90 | 90 |
| 91 // For debug check only. Access only on drag-and-drop thread. | 91 // For debug check only. Access only on drag-and-drop thread. |
| 92 base::PlatformThreadId drag_drop_thread_id_; | 92 base::PlatformThreadId drag_drop_thread_id_; |
| 93 | 93 |
| 94 // All the member variables below are accessed on UI thread. | 94 // All the member variables below are accessed on UI thread. |
| 95 | 95 |
| 96 gfx::NativeWindow source_window_; | 96 gfx::NativeWindow source_window_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 110 bool drag_ended_; | 110 bool drag_ended_; |
| 111 | 111 |
| 112 base::Callback<void()> drag_end_callback_; | 112 base::Callback<void()> drag_end_callback_; |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(WebContentsDragWin); | 114 DISALLOW_COPY_AND_ASSIGN(WebContentsDragWin); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 } // namespace content | 117 } // namespace content |
| 118 | 118 |
| 119 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_ | 119 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_ |
| OLD | NEW |