Commit 95f072f9 authored by jam@chromium.org's avatar jam@chromium.org

Move TabContentsDragWin to content and rename it to WebContentsDragWin.

BUG=98716
Review URL: https://chromiumcodereview.appspot.com/9594012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124951 0039d316-1c4b-4281-b951-d872f2087c98
parent e48f67f2
......@@ -39,8 +39,6 @@ include_rules = [
"+content/browser/download/download_persistent_store_info.h",
"+content/browser/download/download_state_info.h",
"+content/browser/download/download_types.h",
"+content/browser/download/drag_download_file.h",
"+content/browser/download/drag_download_util.h",
"+content/browser/download/interrupt_reasons.h",
"+content/browser/find_pasteboard.h",
"+content/browser/geolocation/wifi_data_provider_common.h",
......@@ -65,17 +63,15 @@ include_rules = [
"+content/browser/tab_contents/provisional_load_details.h",
"+content/browser/tab_contents/tab_contents_view_gtk.h",
"+content/browser/tab_contents/tab_contents_view_helper.h",
"+content/browser/tab_contents/tab_contents_view_wrapper_gtk.h",
"+content/browser/tab_contents/test_tab_contents.h",
"+content/browser/tab_contents/title_updated_details.h",
"+content/browser/tab_contents/web_contents_drag_win.h",
"+content/browser/tab_contents/web_contents_view_android.h",
"+content/browser/tab_contents/web_contents_view_mac.h",
"+content/browser/tab_contents/web_drag_dest_delegate.h",
"+content/browser/tab_contents/web_drag_dest_gtk.h",
"+content/browser/tab_contents/web_drag_dest_win.h",
"+content/browser/tab_contents/web_drag_source_gtk.h",
"+content/browser/tab_contents/web_drag_source_win.h",
"+content/browser/tab_contents/web_drag_utils_win.h",
"+content/browser/trace_controller.h",
# DO NOT ADD ANY MORE ITEMS TO THE ABOVE LIST!
......
......@@ -7,7 +7,7 @@
#include "base/bind.h"
#include "chrome/browser/tab_contents/web_drag_bookmark_handler_win.h"
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_delegate.h"
#include "chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h"
#include "content/browser/tab_contents/web_contents_drag_win.h"
#include "content/browser/tab_contents/web_drag_dest_win.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
......@@ -136,7 +136,7 @@ void NativeTabContentsViewWin::StartDragging(const WebDropData& drop_data,
WebKit::WebDragOperationsMask ops,
const SkBitmap& image,
const gfx::Point& image_offset) {
drag_handler_ = new TabContentsDragWin(
drag_handler_ = new WebContentsDragWin(
GetNativeView(),
delegate_->GetWebContents(),
drag_dest_,
......
......@@ -11,7 +11,7 @@
class WebDragBookmarkHandlerWin;
class WebDragDest;
class TabContentsDragWin;
class WebContentsDragWin;
namespace content {
class RenderWidgetHostView;
......@@ -81,7 +81,7 @@ class NativeTabContentsViewWin : public views::NativeWidgetWin,
scoped_refptr<WebDragDest> drag_dest_;
// Used to handle the drag-and-drop.
scoped_refptr<TabContentsDragWin> drag_handler_;
scoped_refptr<WebContentsDragWin> drag_handler_;
DISALLOW_COPY_AND_ASSIGN(NativeTabContentsViewWin);
};
......
......@@ -3839,8 +3839,6 @@
'browser/ui/views/tab_contents/render_view_context_menu_views.h',
'browser/ui/views/tab_contents/tab_contents_container.cc',
'browser/ui/views/tab_contents/tab_contents_container.h',
'browser/ui/views/tab_contents/tab_contents_drag_win.cc',
'browser/ui/views/tab_contents/tab_contents_drag_win.h',
'browser/ui/views/tab_contents/tab_contents_view_views.cc',
'browser/ui/views/tab_contents/tab_contents_view_views.h',
'browser/ui/views/tab_icon_view.cc',
......@@ -4587,8 +4585,6 @@
['exclude', '^browser/ui/views/tab_contents/native_tab_contents_container_win.h'],
['exclude', '^browser/ui/views/tab_contents/native_tab_contents_view_win.cc'],
['exclude', '^browser/ui/views/tab_contents/native_tab_contents_view_win.h'],
['exclude', '^browser/ui/views/tab_contents/tab_contents_drag_win.cc'],
['exclude', '^browser/ui/views/tab_contents/tab_contents_drag_win.h'],
['exclude', '^browser/ui/views/tabs/native_view_photobooth.h'],
['exclude', '^browser/ui/views/tabs/native_view_photobooth_win.cc'],
['exclude', '^browser/ui/views/tabs/native_view_photobooth_win.h'],
......
......@@ -10,7 +10,6 @@
#include "base/file_path.h"
#include "base/memory/linked_ptr.h"
#include "content/browser/download/download_file.h"
#include "content/common/content_export.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/download_manager.h"
#include "googleurl/src/gurl.h"
......@@ -27,7 +26,7 @@ namespace net {
class FileStream;
}
class CONTENT_EXPORT DragDownloadFile
class DragDownloadFile
: public ui::DownloadFileProvider,
public content::DownloadManager::Observer,
public content::DownloadItem::Observer {
......
......@@ -10,7 +10,6 @@
#include "base/memory/ref_counted.h"
#include "base/string16.h"
#include "content/browser/download/drag_download_file.h"
#include "content/common/content_export.h"
#include "ui/base/dragdrop/download_file_interface.h"
class FilePath;
......@@ -30,20 +29,20 @@ namespace drag_download_util {
// appropriately.
// For example, we can have
// text/plain:example.txt:http://example.com/example.txt
CONTENT_EXPORT bool ParseDownloadMetadata(const string16& metadata,
string16* mime_type,
FilePath* file_name,
GURL* url);
bool ParseDownloadMetadata(const string16& metadata,
string16* mime_type,
FilePath* file_name,
GURL* url);
// Create a new file at the specified path. If the file already exists, try to
// insert the sequential unifier to produce a new file, like foo-01.txt.
// Return a FileStream if successful.
// |net_log| is a NetLog for the stream.
CONTENT_EXPORT net::FileStream* CreateFileStreamForDrop(
net::FileStream* CreateFileStreamForDrop(
FilePath* file_path, net::NetLog* net_log);
// Implementation of DownloadFileObserver to finalize the download process.
class CONTENT_EXPORT PromiseFileFinalizer : public ui::DownloadFileObserver {
class PromiseFileFinalizer : public ui::DownloadFileObserver {
public:
explicit PromiseFileFinalizer(DragDownloadFile* drag_file_downloader);
virtual ~PromiseFileFinalizer();
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h"
#include "content/browser/tab_contents/web_contents_drag_win.h"
#include <windows.h>
......@@ -72,7 +72,7 @@ LRESULT CALLBACK MsgFilterProc(int code, WPARAM wparam, LPARAM lparam) {
class DragDropThread : public base::Thread {
public:
explicit DragDropThread(TabContentsDragWin* drag_handler)
explicit DragDropThread(WebContentsDragWin* drag_handler)
: base::Thread("Chrome_DragDropThread"),
drag_handler_(drag_handler) {
}
......@@ -93,14 +93,14 @@ class DragDropThread : public base::Thread {
}
private:
// Hold a reference count to TabContentsDragWin to make sure that it is always
// Hold a reference count to WebContentsDragWin to make sure that it is always
// alive in the thread lifetime.
scoped_refptr<TabContentsDragWin> drag_handler_;
scoped_refptr<WebContentsDragWin> drag_handler_;
DISALLOW_COPY_AND_ASSIGN(DragDropThread);
};
TabContentsDragWin::TabContentsDragWin(
WebContentsDragWin::WebContentsDragWin(
gfx::NativeWindow source_window,
content::WebContents* web_contents,
WebDragDest* drag_dest,
......@@ -114,12 +114,12 @@ TabContentsDragWin::TabContentsDragWin(
drag_end_callback_(drag_end_callback) {
}
TabContentsDragWin::~TabContentsDragWin() {
WebContentsDragWin::~WebContentsDragWin() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!drag_drop_thread_.get());
}
void TabContentsDragWin::StartDragging(const WebDropData& drop_data,
void WebContentsDragWin::StartDragging(const WebDropData& drop_data,
WebDragOperationsMask ops,
const SkBitmap& image,
const gfx::Point& image_offset) {
......@@ -149,7 +149,7 @@ void TabContentsDragWin::StartDragging(const WebDropData& drop_data,
if (drag_drop_thread_->StartWithOptions(options)) {
drag_drop_thread_->message_loop()->PostTask(
FROM_HERE,
base::Bind(&TabContentsDragWin::StartBackgroundDragging, this,
base::Bind(&WebContentsDragWin::StartBackgroundDragging, this,
drop_data, ops, page_url, page_encoding, image,
image_offset));
}
......@@ -169,7 +169,7 @@ void TabContentsDragWin::StartDragging(const WebDropData& drop_data,
AttachThreadInput(drag_out_thread_id, GetCurrentThreadId(), TRUE);
}
void TabContentsDragWin::StartBackgroundDragging(
void WebContentsDragWin::StartBackgroundDragging(
const WebDropData& drop_data,
WebDragOperationsMask ops,
const GURL& page_url,
......@@ -182,10 +182,10 @@ void TabContentsDragWin::StartBackgroundDragging(
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&TabContentsDragWin::EndDragging, this, true));
base::Bind(&WebContentsDragWin::EndDragging, this, true));
}
void TabContentsDragWin::PrepareDragForDownload(
void WebContentsDragWin::PrepareDragForDownload(
const WebDropData& drop_data,
ui::OSExchangeData* data,
const GURL& page_url,
......@@ -229,7 +229,7 @@ void TabContentsDragWin::PrepareDragForDownload(
ui::OSExchangeDataProviderWin::GetIAsyncOperation(*data)->SetAsyncMode(TRUE);
}
void TabContentsDragWin::PrepareDragForFileContents(
void WebContentsDragWin::PrepareDragForFileContents(
const WebDropData& drop_data, ui::OSExchangeData* data) {
static const int kMaxFilenameLength = 255; // FAT and NTFS
FilePath file_name(drop_data.file_description_filename);
......@@ -250,7 +250,7 @@ void TabContentsDragWin::PrepareDragForFileContents(
data->SetFileContents(file_name, drop_data.file_contents);
}
void TabContentsDragWin::PrepareDragForUrl(const WebDropData& drop_data,
void WebContentsDragWin::PrepareDragForUrl(const WebDropData& drop_data,
ui::OSExchangeData* data) {
if (drag_dest_->delegate()->AddDragData(drop_data, data))
return;
......@@ -258,7 +258,7 @@ void TabContentsDragWin::PrepareDragForUrl(const WebDropData& drop_data,
data->SetURL(drop_data.url, drop_data.url_title);
}
void TabContentsDragWin::DoDragging(const WebDropData& drop_data,
void WebContentsDragWin::DoDragging(const WebDropData& drop_data,
WebDragOperationsMask ops,
const GURL& page_url,
const std::string& page_encoding,
......@@ -316,7 +316,7 @@ void TabContentsDragWin::DoDragging(const WebDropData& drop_data,
drag_source_->set_effect(effect);
}
void TabContentsDragWin::EndDragging(bool restore_suspended_state) {
void WebContentsDragWin::EndDragging(bool restore_suspended_state) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (drag_ended_)
......@@ -335,19 +335,19 @@ void TabContentsDragWin::EndDragging(bool restore_suspended_state) {
drag_end_callback_.Run();
}
void TabContentsDragWin::CancelDrag() {
void WebContentsDragWin::CancelDrag() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
drag_source_->CancelDrag();
}
void TabContentsDragWin::CloseThread() {
void WebContentsDragWin::CloseThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
drag_drop_thread_.reset();
}
void TabContentsDragWin::OnWaitForData() {
void WebContentsDragWin::OnWaitForData() {
DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId());
// When the left button is release and we start to wait for the data, end
......@@ -356,10 +356,10 @@ void TabContentsDragWin::OnWaitForData() {
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&TabContentsDragWin::EndDragging, this, true));
base::Bind(&WebContentsDragWin::EndDragging, this, true));
}
void TabContentsDragWin::OnDataObjectDisposed() {
void WebContentsDragWin::OnDataObjectDisposed() {
DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId());
// The drag-and-drop thread is only closed after OLE is done with
......@@ -367,5 +367,5 @@ void TabContentsDragWin::OnDataObjectDisposed() {
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&TabContentsDragWin::CloseThread, this));
base::Bind(&WebContentsDragWin::CloseThread, this));
}
......@@ -2,14 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_
#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_
#ifndef CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_
#define CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_
#pragma once
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/platform_thread.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/dragdrop/os_exchange_data_provider_win.h"
......@@ -30,15 +32,15 @@ class WebContents;
// thread to do the drag-and-drop because we do not want to run nested
// message loop in the UI thread. For all other cases, the drag-and-drop happens
// in the UI thread.
class TabContentsDragWin
: public ui::DataObjectImpl::Observer,
public base::RefCountedThreadSafe<TabContentsDragWin> {
class CONTENT_EXPORT WebContentsDragWin
: NON_EXPORTED_BASE(public ui::DataObjectImpl::Observer),
public base::RefCountedThreadSafe<WebContentsDragWin> {
public:
TabContentsDragWin(gfx::NativeWindow source_window,
WebContentsDragWin(gfx::NativeWindow source_window,
content::WebContents* web_contents,
WebDragDest* drag_dest,
const base::Callback<void()>& drag_end_callback);
virtual ~TabContentsDragWin();
virtual ~WebContentsDragWin();
// Called on UI thread.
void StartDragging(const WebDropData& drop_data,
......@@ -106,8 +108,7 @@ class TabContentsDragWin
base::Callback<void()> drag_end_callback_;
DISALLOW_COPY_AND_ASSIGN(TabContentsDragWin);
DISALLOW_COPY_AND_ASSIGN(WebContentsDragWin);
};
#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_
#endif // CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_
......@@ -7,7 +7,6 @@
#pragma once
#include "base/basictypes.h"
#include "content/common/content_export.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/base/dragdrop/drag_source.h"
......@@ -24,8 +23,8 @@ class WebContents;
// by an active drag-drop operation as the user mouses over other drop targets
// on their system. This object tells Windows whether or not the drag should
// continue, and supplies the appropriate cursors.
class CONTENT_EXPORT WebDragSource : public ui::DragSource,
public content::NotificationObserver {
class WebDragSource : public ui::DragSource,
public content::NotificationObserver {
public:
// Create a new DragSource for a given HWND and WebContents.
WebDragSource(gfx::NativeWindow source_wnd,
......
......@@ -6,7 +6,6 @@
#define CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_UTILS_WIN_H_
#pragma once
#include "content/common/content_export.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
#include <windows.h>
......@@ -17,8 +16,7 @@ WebKit::WebDragOperation WinDragOpToWebDragOp(DWORD effect);
WebKit::WebDragOperationsMask WinDragOpMaskToWebDragOpMask(DWORD effects);
DWORD WebDragOpToWinDragOp(WebKit::WebDragOperation op);
CONTENT_EXPORT DWORD WebDragOpMaskToWinDragOpMask(
WebKit::WebDragOperationsMask ops);
DWORD WebDragOpMaskToWinDragOpMask(WebKit::WebDragOperationsMask ops);
} // namespace web_drag_utils_win
......
......@@ -649,6 +649,8 @@
'browser/tab_contents/tab_contents_view_helper.cc',
'browser/tab_contents/tab_contents_view_helper.h',
'browser/tab_contents/title_updated_details.h',
'browser/tab_contents/web_contents_drag_win.cc',
'browser/tab_contents/web_contents_drag_win.h',
'browser/tab_contents/web_contents_view_android.cc',
'browser/tab_contents/web_contents_view_android.h',
'browser/tab_contents/web_contents_view_mac.h',
......@@ -834,6 +836,8 @@
['exclude', '^browser/renderer_host/render_widget_host_view_win.cc'],
['exclude', '^browser/renderer_host/render_widget_host_view_win.h'],
['exclude', '^browser/renderer_host/render_message_filter_win.cc'],
['exclude', '^browser/tab_contents/web_contents_drag_win.cc'],
['exclude', '^browser/tab_contents/web_contents_drag_win.h'],
['exclude', '^browser/tab_contents/web_drag_dest_win.cc'],
['exclude', '^browser/tab_contents/web_drag_dest_win.h'],
['exclude', '^browser/tab_contents/web_drag_source_win.cc'],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment