mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	Add a new NAVTYPE_LINKDROPPED value to the cef_handler_navtype_t enum passed to OnBeforeResourceLoad() that will be passed when navigation is resulting from a drop (issue #363).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@320 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
		| @@ -525,6 +525,7 @@ enum cef_handler_navtype_t | |||||||
|   NAVTYPE_RELOAD, |   NAVTYPE_RELOAD, | ||||||
|   NAVTYPE_FORMRESUBMITTED, |   NAVTYPE_FORMRESUBMITTED, | ||||||
|   NAVTYPE_OTHER, |   NAVTYPE_OTHER, | ||||||
|  |   NAVTYPE_LINKDROPPED, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /// | /// | ||||||
|   | |||||||
| @@ -163,10 +163,20 @@ CefBrowserImpl::CefBrowserImpl(const CefWindowInfo& windowInfo, | |||||||
|                                const CefBrowserSettings& settings, |                                const CefBrowserSettings& settings, | ||||||
|                                gfx::NativeView opener, |                                gfx::NativeView opener, | ||||||
|                                CefRefPtr<CefClient> client) |                                CefRefPtr<CefClient> client) | ||||||
|   : window_info_(windowInfo), settings_(settings), opener_(opener), |   : window_info_(windowInfo), | ||||||
|     is_modal_(false), client_(client), webviewhost_(NULL), popuphost_(NULL), |     settings_(settings), | ||||||
|     zoom_level_(0.0), can_go_back_(false), can_go_forward_(false), |     opener_(opener), | ||||||
|     has_document_(false), main_frame_(NULL), unique_id_(0) |     is_modal_(false), | ||||||
|  |     client_(client), | ||||||
|  |     webviewhost_(NULL), | ||||||
|  |     popuphost_(NULL), | ||||||
|  |     zoom_level_(0.0), | ||||||
|  |     can_go_back_(false), | ||||||
|  |     can_go_forward_(false), | ||||||
|  |     has_document_(false), | ||||||
|  |     is_dropping_(false), | ||||||
|  |     main_frame_(NULL), | ||||||
|  |     unique_id_(0) | ||||||
| #if defined(OS_WIN) | #if defined(OS_WIN) | ||||||
|     , opener_was_disabled_by_modal_loop_(false), |     , opener_was_disabled_by_modal_loop_(false), | ||||||
|     internal_modal_message_loop_is_active_(false) |     internal_modal_message_loop_is_active_(false) | ||||||
|   | |||||||
| @@ -327,6 +327,9 @@ public: | |||||||
|   void set_has_document(bool has_document); |   void set_has_document(bool has_document); | ||||||
|   bool has_document(); |   bool has_document(); | ||||||
|  |  | ||||||
|  |   void set_is_dropping(bool is_dropping) { is_dropping_ = is_dropping; } | ||||||
|  |   bool is_dropping() { return is_dropping_; } | ||||||
|  |  | ||||||
| #if defined(OS_WIN) | #if defined(OS_WIN) | ||||||
|   void set_opener_was_disabled_by_modal_loop(bool disabled) |   void set_opener_was_disabled_by_modal_loop(bool disabled) | ||||||
|   { |   { | ||||||
| @@ -374,6 +377,9 @@ protected: | |||||||
|   bool can_go_forward_; |   bool can_go_forward_; | ||||||
|   bool has_document_; |   bool has_document_; | ||||||
|  |  | ||||||
|  |   // True if a drop action is occuring. | ||||||
|  |   bool is_dropping_; | ||||||
|  |  | ||||||
| #if defined(OS_WIN) | #if defined(OS_WIN) | ||||||
|   // Context object used to manage printing. |   // Context object used to manage printing. | ||||||
|   printing::PrintingContext print_context_; |   printing::PrintingContext print_context_; | ||||||
|   | |||||||
| @@ -738,9 +738,15 @@ WebNavigationPolicy BrowserWebViewDelegate::decidePolicyForNavigation( | |||||||
|       if(map.size() > 0) |       if(map.size() > 0) | ||||||
|         static_cast<CefRequestImpl*>(req.get())->SetHeaderMap(map); |         static_cast<CefRequestImpl*>(req.get())->SetHeaderMap(map); | ||||||
|  |  | ||||||
|  |       cef_handler_navtype_t navType; | ||||||
|  |       if (browser_->is_dropping()) | ||||||
|  |         navType = NAVTYPE_LINKDROPPED; | ||||||
|  |       else | ||||||
|  |         navType = (cef_handler_navtype_t)type; | ||||||
|  |  | ||||||
|       // Notify the handler of a browse request |       // Notify the handler of a browse request | ||||||
|       bool handled = handler->OnBeforeBrowse(browser_, |       bool handled = handler->OnBeforeBrowse(browser_, | ||||||
|           browser_->UIT_GetCefFrame(frame), req, (cef_handler_navtype_t)type, |           browser_->UIT_GetCefFrame(frame), req, navType, | ||||||
|           is_redirect); |           is_redirect); | ||||||
|       if(handled) |       if(handled) | ||||||
|         return WebKit::WebNavigationPolicyIgnore; |         return WebKit::WebNavigationPolicyIgnore; | ||||||
|   | |||||||
| @@ -195,8 +195,11 @@ using WebKit::WebView; | |||||||
|   NSPoint windowPoint = [info draggingLocation]; |   NSPoint windowPoint = [info draggingLocation]; | ||||||
|   NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; |   NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; | ||||||
|   NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; |   NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; | ||||||
|  |  | ||||||
|  |   view_.browser->set_is_dropping(true); | ||||||
|   webview->dragTargetDrop(gfx::Point(viewPoint.x, viewPoint.y), |   webview->dragTargetDrop(gfx::Point(viewPoint.x, viewPoint.y), | ||||||
|                           gfx::Point(screenPoint.x, screenPoint.y)); |                           gfx::Point(screenPoint.x, screenPoint.y)); | ||||||
|  |   view_.browser->set_is_dropping(false); | ||||||
|  |  | ||||||
|   return YES; |   return YES; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -146,9 +146,12 @@ DWORD WebDropTarget::OnDrop(IDataObject* data_object, | |||||||
|  |  | ||||||
|   POINT client_pt = cursor_position; |   POINT client_pt = cursor_position; | ||||||
|   ScreenToClient(GetHWND(), &client_pt); |   ScreenToClient(GetHWND(), &client_pt); | ||||||
|  |  | ||||||
|  |   browser_->set_is_dropping(true); | ||||||
|   browser_->UIT_GetWebView()->dragTargetDrop( |   browser_->UIT_GetWebView()->dragTargetDrop( | ||||||
|       WebPoint(client_pt.x, client_pt.y), |       WebPoint(client_pt.x, client_pt.y), | ||||||
|       WebPoint(cursor_position.x, cursor_position.y)); |       WebPoint(cursor_position.x, cursor_position.y)); | ||||||
|  |   browser_->set_is_dropping(false); | ||||||
|  |  | ||||||
|   current_wvh_ = NULL; |   current_wvh_ = NULL; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user