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:
Marshall Greenblatt 2011-10-18 00:23:32 +00:00
parent 78c23fc30b
commit 7130cc4f26
6 changed files with 34 additions and 5 deletions

View File

@ -525,6 +525,7 @@ enum cef_handler_navtype_t
NAVTYPE_RELOAD,
NAVTYPE_FORMRESUBMITTED,
NAVTYPE_OTHER,
NAVTYPE_LINKDROPPED,
};
///

View File

@ -163,10 +163,20 @@ CefBrowserImpl::CefBrowserImpl(const CefWindowInfo& windowInfo,
const CefBrowserSettings& settings,
gfx::NativeView opener,
CefRefPtr<CefClient> client)
: window_info_(windowInfo), settings_(settings), opener_(opener),
is_modal_(false), client_(client), webviewhost_(NULL), popuphost_(NULL),
zoom_level_(0.0), can_go_back_(false), can_go_forward_(false),
has_document_(false), main_frame_(NULL), unique_id_(0)
: window_info_(windowInfo),
settings_(settings),
opener_(opener),
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)
, opener_was_disabled_by_modal_loop_(false),
internal_modal_message_loop_is_active_(false)

View File

@ -327,6 +327,9 @@ public:
void set_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)
void set_opener_was_disabled_by_modal_loop(bool disabled)
{
@ -374,6 +377,9 @@ protected:
bool can_go_forward_;
bool has_document_;
// True if a drop action is occuring.
bool is_dropping_;
#if defined(OS_WIN)
// Context object used to manage printing.
printing::PrintingContext print_context_;

View File

@ -738,9 +738,15 @@ WebNavigationPolicy BrowserWebViewDelegate::decidePolicyForNavigation(
if(map.size() > 0)
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
bool handled = handler->OnBeforeBrowse(browser_,
browser_->UIT_GetCefFrame(frame), req, (cef_handler_navtype_t)type,
browser_->UIT_GetCefFrame(frame), req, navType,
is_redirect);
if(handled)
return WebKit::WebNavigationPolicyIgnore;

View File

@ -195,8 +195,11 @@ using WebKit::WebView;
NSPoint windowPoint = [info draggingLocation];
NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view];
NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view];
view_.browser->set_is_dropping(true);
webview->dragTargetDrop(gfx::Point(viewPoint.x, viewPoint.y),
gfx::Point(screenPoint.x, screenPoint.y));
view_.browser->set_is_dropping(false);
return YES;
}

View File

@ -146,9 +146,12 @@ DWORD WebDropTarget::OnDrop(IDataObject* data_object,
POINT client_pt = cursor_position;
ScreenToClient(GetHWND(), &client_pt);
browser_->set_is_dropping(true);
browser_->UIT_GetWebView()->dragTargetDrop(
WebPoint(client_pt.x, client_pt.y),
WebPoint(cursor_position.x, cursor_position.y));
browser_->set_is_dropping(false);
current_wvh_ = NULL;