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

Side by Side Diff: chrome/browser/tab_contents/web_drag_source_win.cc

Issue 9015022: Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/tab_contents/web_drag_source_win.h" 5 #include "chrome/browser/tab_contents/web_drag_source_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/tab_contents/web_drag_utils_win.h" 8 #include "chrome/browser/tab_contents/web_drag_utils_win.h"
9 #include "content/browser/renderer_host/render_view_host.h" 9 #include "content/browser/renderer_host/render_view_host.h"
10 #include "content/browser/tab_contents/tab_contents.h" 10 #include "content/browser/tab_contents/tab_contents.h"
(...skipping 20 matching lines...) Expand all
31 31
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 TabContents* tab_contents) 36 TabContents* tab_contents)
37 : ui::DragSource(), 37 : ui::DragSource(),
38 source_wnd_(source_wnd), 38 source_wnd_(source_wnd),
39 render_view_host_(tab_contents->GetRenderViewHost()), 39 render_view_host_(tab_contents->GetRenderViewHost()),
40 effect_(DROPEFFECT_NONE) { 40 effect_(DROPEFFECT_NONE) {
41 registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_SWAPPED, 41 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_SWAPPED,
42 content::Source<TabContents>(tab_contents)); 42 content::Source<WebContents>(tab_contents));
43 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, 43 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
44 content::Source<WebContents>(tab_contents)); 44 content::Source<WebContents>(tab_contents));
45 } 45 }
46 46
47 WebDragSource::~WebDragSource() { 47 WebDragSource::~WebDragSource() {
48 } 48 }
49 49
50 void WebDragSource::OnDragSourceCancel() { 50 void WebDragSource::OnDragSourceCancel() {
51 // Delegate to the UI thread if we do drag-and-drop in the background thread. 51 // Delegate to the UI thread if we do drag-and-drop in the background thread.
52 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 52 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 gfx::Point client; 105 gfx::Point client;
106 gfx::Point screen; 106 gfx::Point screen;
107 GetCursorPositions(source_wnd_, &client, &screen); 107 GetCursorPositions(source_wnd_, &client, &screen);
108 render_view_host_->DragSourceMovedTo(client.x(), client.y(), 108 render_view_host_->DragSourceMovedTo(client.x(), client.y(),
109 screen.x(), screen.y()); 109 screen.x(), screen.y());
110 } 110 }
111 111
112 void WebDragSource::Observe(int type, 112 void WebDragSource::Observe(int type,
113 const content::NotificationSource& source, 113 const content::NotificationSource& source,
114 const content::NotificationDetails& details) { 114 const content::NotificationDetails& details) {
115 if (content::NOTIFICATION_TAB_CONTENTS_SWAPPED == type) { 115 if (content::NOTIFICATION_WEB_CONTENTS_SWAPPED == type) {
116 // When the tab contents get swapped, our render view host goes away. 116 // When the tab contents get swapped, our render view host goes away.
117 // That's OK, we can continue the drag, we just can't send messages back to 117 // That's OK, we can continue the drag, we just can't send messages back to
118 // our drag source. 118 // our drag source.
119 render_view_host_ = NULL; 119 render_view_host_ = NULL;
120 } else if (content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED == type) { 120 } else if (content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED == type) {
121 // This could be possible when we close the tab and the source is still 121 // This could be possible when we close the tab and the source is still
122 // being used in DoDragDrop at the time that the virtual file is being 122 // being used in DoDragDrop at the time that the virtual file is being
123 // downloaded. 123 // downloaded.
124 render_view_host_ = NULL; 124 render_view_host_ = NULL;
125 } 125 }
126 } 126 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu_browsertest.cc ('k') | chrome/browser/tabs/tab_finder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698