summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/frame/browser_root_view.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views/frame/browser_root_view.cc')
-rw-r--r--chrome/browser/views/frame/browser_root_view.cc41
1 files changed, 24 insertions, 17 deletions
diff --git a/chrome/browser/views/frame/browser_root_view.cc b/chrome/browser/views/frame/browser_root_view.cc
index 5e471c6..753a3314 100644
--- a/chrome/browser/views/frame/browser_root_view.cc
+++ b/chrome/browser/views/frame/browser_root_view.cc
@@ -13,18 +13,27 @@
BrowserRootView::BrowserRootView(views::Widget* widget)
: views::RootView(widget),
tabstrip_(NULL),
- can_drop_(false),
forwarding_to_tab_strip_(false) {
}
+bool BrowserRootView::GetDropFormats(
+ int* formats,
+ std::set<OSExchangeData::CustomFormat>* custom_formats) {
+ if (tabstrip_ && tabstrip_->GetView()->IsVisible() &&
+ !tabstrip_->IsAnimating()) {
+ *formats = OSExchangeData::URL;
+ return true;
+ }
+ return false;
+}
+
bool BrowserRootView::CanDrop(const OSExchangeData& data) {
- can_drop_ = (tabstrip_ && tabstrip_->GetView()->IsVisible() &&
- !tabstrip_->IsAnimating() && data.HasURL());
- return can_drop_;
+ return (tabstrip_ && tabstrip_->GetView()->IsVisible() &&
+ !tabstrip_->IsAnimating());
}
void BrowserRootView::OnDragEntered(const views::DropTargetEvent& event) {
- if (can_drop_ && ShouldForwardToTabStrip(event)) {
+ if (ShouldForwardToTabStrip(event)) {
forwarding_to_tab_strip_ = true;
scoped_ptr<views::DropTargetEvent> mapped_event(MapEventToTabStrip(event));
tabstrip_->GetView()->OnDragEntered(*mapped_event.get());
@@ -32,19 +41,17 @@ void BrowserRootView::OnDragEntered(const views::DropTargetEvent& event) {
}
int BrowserRootView::OnDragUpdated(const views::DropTargetEvent& event) {
- if (can_drop_) {
- if (ShouldForwardToTabStrip(event)) {
- scoped_ptr<views::DropTargetEvent> mapped_event(
- MapEventToTabStrip(event));
- if (!forwarding_to_tab_strip_) {
- tabstrip_->GetView()->OnDragEntered(*mapped_event.get());
- forwarding_to_tab_strip_ = true;
- }
- return tabstrip_->GetView()->OnDragUpdated(*mapped_event.get());
- } else if (forwarding_to_tab_strip_) {
- forwarding_to_tab_strip_ = false;
- tabstrip_->GetView()->OnDragExited();
+ if (ShouldForwardToTabStrip(event)) {
+ scoped_ptr<views::DropTargetEvent> mapped_event(
+ MapEventToTabStrip(event));
+ if (!forwarding_to_tab_strip_) {
+ tabstrip_->GetView()->OnDragEntered(*mapped_event.get());
+ forwarding_to_tab_strip_ = true;
}
+ return tabstrip_->GetView()->OnDragUpdated(*mapped_event.get());
+ } else if (forwarding_to_tab_strip_) {
+ forwarding_to_tab_strip_ = false;
+ tabstrip_->GetView()->OnDragExited();
}
return DragDropTypes::DRAG_NONE;
}