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

Side by Side Diff: content/browser/web_contents/web_drag_source_win.cc

Issue 23618036: Merge NOTIFICATION_RENDER_VIEW_HOST_CHANGED into NOTIFICATION_WEB_CONTENTS_SWAPPED. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "content/browser/web_contents/web_drag_source_win.h" 5 #include "content/browser/web_contents/web_drag_source_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/browser/renderer_host/render_view_host_impl.h" 8 #include "content/browser/renderer_host/render_view_host_impl.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/browser/web_contents/web_drag_utils_win.h" 10 #include "content/browser/web_contents/web_drag_utils_win.h"
(...skipping 21 matching lines...) Expand all
32 /////////////////////////////////////////////////////////////////////////////// 32 ///////////////////////////////////////////////////////////////////////////////
33 // WebDragSource, public: 33 // WebDragSource, public:
34 34
35 WebDragSource::WebDragSource(gfx::NativeWindow source_wnd, 35 WebDragSource::WebDragSource(gfx::NativeWindow source_wnd,
36 WebContents* web_contents) 36 WebContents* web_contents)
37 : ui::DragSourceWin(), 37 : ui::DragSourceWin(),
38 source_wnd_(source_wnd), 38 source_wnd_(source_wnd),
39 web_contents_(static_cast<WebContentsImpl*>(web_contents)), 39 web_contents_(static_cast<WebContentsImpl*>(web_contents)),
40 effect_(DROPEFFECT_NONE), 40 effect_(DROPEFFECT_NONE),
41 data_(NULL) { 41 data_(NULL) {
42 registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_SWAPPED, 42 registrar_.Add(this, NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
43 Source<WebContents>(web_contents)); 43 Source<WebContents>(web_contents));
44 registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_DISCONNECTED, 44 registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
45 Source<WebContents>(web_contents)); 45 Source<WebContents>(web_contents));
46 } 46 }
47 47
48 WebDragSource::~WebDragSource() { 48 WebDragSource::~WebDragSource() {
49 } 49 }
50 50
51 void WebDragSource::OnDragSourceCancel() { 51 void WebDragSource::OnDragSourceCancel() {
52 // Delegate to the UI thread if we do drag-and-drop in the background thread. 52 // Delegate to the UI thread if we do drag-and-drop in the background thread.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 gfx::Point client; 107 gfx::Point client;
108 gfx::Point screen; 108 gfx::Point screen;
109 GetCursorPositions(source_wnd_, &client, &screen); 109 GetCursorPositions(source_wnd_, &client, &screen);
110 web_contents_->DragSourceMovedTo(client.x(), client.y(), 110 web_contents_->DragSourceMovedTo(client.x(), client.y(),
111 screen.x(), screen.y()); 111 screen.x(), screen.y());
112 } 112 }
113 113
114 void WebDragSource::Observe(int type, 114 void WebDragSource::Observe(int type,
115 const NotificationSource& source, 115 const NotificationSource& source,
116 const NotificationDetails& details) { 116 const NotificationDetails& details) {
117 if (type == NOTIFICATION_WEB_CONTENTS_SWAPPED) { 117 if (type == NOTIFICATION_RENDER_VIEW_HOST_CHANGED) {
118 // When the WebContents get swapped, our render view host goes away. 118 // When the WebContents get swapped, our render view host goes away.
119 // That's OK, we can continue the drag, we just can't send messages back to 119 // That's OK, we can continue the drag, we just can't send messages back to
120 // our drag source. 120 // our drag source.
121 web_contents_ = NULL; 121 web_contents_ = NULL;
122 } else if (type == NOTIFICATION_WEB_CONTENTS_DISCONNECTED) { 122 } else if (type == NOTIFICATION_WEB_CONTENTS_DISCONNECTED) {
123 // This could be possible when we close the tab and the source is still 123 // This could be possible when we close the tab and the source is still
124 // being used in DoDragDrop at the time that the virtual file is being 124 // being used in DoDragDrop at the time that the virtual file is being
125 // downloaded. 125 // downloaded.
126 web_contents_ = NULL; 126 web_contents_ = NULL;
127 } 127 }
128 } 128 }
129 129
130 } // namespace content 130 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698