summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_focus_uitest.cc11
-rw-r--r--chrome/browser/browser_init_browsertest.cc1
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc5
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc14
-rw-r--r--chrome/browser/views/bookmark_bar_view.h4
-rw-r--r--chrome/browser/views/bookmark_menu_button.cc16
-rw-r--r--chrome/browser/views/bookmark_menu_button.h4
-rw-r--r--chrome/browser/views/frame/browser_root_view.cc41
-rw-r--r--chrome/browser/views/frame/browser_root_view.h6
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_test_base.cc3
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.cc3
11 files changed, 25 insertions, 83 deletions
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index 4007ebd..1c1c012 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -7,11 +7,12 @@
#include "base/ref_counted.h"
#include "chrome/browser/automation/ui_controls.h"
#include "chrome/browser/browser.h"
-#include "chrome/browser/browser_window.h"
-#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/tab_contents/interstitial_page.h"
#include "chrome/browser/view_ids.h"
+#include "chrome/browser/views/frame/browser_view.h"
+#include "chrome/browser/views/location_bar_view.h"
+#include "chrome/browser/views/tab_contents/tab_contents_container.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
@@ -19,12 +20,6 @@
#include "views/view.h"
#include "views/window/window.h"
-#if defined(TOOLKIT_VIEWS)
-#include "chrome/browser/views/frame/browser_view.h"
-#include "chrome/browser/views/location_bar_view.h"
-#include "chrome/browser/views/tab_contents/tab_contents_container.h"
-#endif
-
#if defined(OS_LINUX)
#include "chrome/browser/gtk/view_id_util.h"
#endif
diff --git a/chrome/browser/browser_init_browsertest.cc b/chrome/browser/browser_init_browsertest.cc
index f5337f4..a343caf 100644
--- a/chrome/browser/browser_init_browsertest.cc
+++ b/chrome/browser/browser_init_browsertest.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/browser_init.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
+#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/test/in_process_browser_test.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index c7d7e19..996f63f 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -15,11 +15,8 @@
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
-#include "webkit/glue/webcursor.h"
-
-#if defined(TOOLKIT_VIEWS)
#include "views/view.h"
-#endif
+#include "webkit/glue/webcursor.h"
#if defined(OS_WIN)
#include "base/gfx/gdi_util.h"
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 4afe926..28bdec8 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -870,20 +870,6 @@ void BookmarkBarView::PaintChildren(gfx::Canvas* canvas) {
}
}
-bool BookmarkBarView::GetDropFormats(
- int* formats,
- std::set<OSExchangeData::CustomFormat>* custom_formats) {
- if (!model_ || !model_->IsLoaded())
- return false;
- *formats = OSExchangeData::URL;
- custom_formats->insert(BookmarkDragData::GetBookmarkCustomFormat());
- return true;
-}
-
-bool BookmarkBarView::AreDropTypesRequired() {
- return true;
-}
-
bool BookmarkBarView::CanDrop(const OSExchangeData& data) {
if (!model_ || !model_->IsLoaded())
return false;
diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h
index caca1aa..b82b669 100644
--- a/chrome/browser/views/bookmark_bar_view.h
+++ b/chrome/browser/views/bookmark_bar_view.h
@@ -97,10 +97,6 @@ class BookmarkBarView : public views::View,
virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
virtual void Paint(gfx::Canvas* canvas);
virtual void PaintChildren(gfx::Canvas* canvas);
- virtual bool GetDropFormats(
- int* formats,
- std::set<OSExchangeData::CustomFormat>* custom_formats);
- virtual bool AreDropTypesRequired();
virtual bool CanDrop(const OSExchangeData& data);
virtual void OnDragEntered(const views::DropTargetEvent& event);
virtual int OnDragUpdated(const views::DropTargetEvent& event);
diff --git a/chrome/browser/views/bookmark_menu_button.cc b/chrome/browser/views/bookmark_menu_button.cc
index 577189e..4a4889b 100644
--- a/chrome/browser/views/bookmark_menu_button.cc
+++ b/chrome/browser/views/bookmark_menu_button.cc
@@ -40,22 +40,6 @@ BookmarkMenuButton::~BookmarkMenuButton() {
bookmark_drop_menu_->set_observer(NULL);
}
-bool BookmarkMenuButton::GetDropFormats(
- int* formats,
- std::set<OSExchangeData::CustomFormat>* custom_formats) {
- BookmarkModel* bookmark_model = GetBookmarkModel();
- if (!bookmark_model || !bookmark_model->IsLoaded())
- return false;
-
- *formats = OSExchangeData::URL;
- custom_formats->insert(BookmarkDragData::GetBookmarkCustomFormat());
- return true;
-}
-
-bool BookmarkMenuButton::AreDropTypesRequired() {
- return true;
-}
-
bool BookmarkMenuButton::CanDrop(const OSExchangeData& data) {
BookmarkModel* bookmark_model = GetBookmarkModel();
if (!bookmark_model || !bookmark_model->IsLoaded())
diff --git a/chrome/browser/views/bookmark_menu_button.h b/chrome/browser/views/bookmark_menu_button.h
index 7a7fd7e..aeed549 100644
--- a/chrome/browser/views/bookmark_menu_button.h
+++ b/chrome/browser/views/bookmark_menu_button.h
@@ -26,10 +26,6 @@ class BookmarkMenuButton : public views::MenuButton,
virtual ~BookmarkMenuButton();
// View drop methods.
- virtual bool GetDropFormats(
- int* formats,
- std::set<OSExchangeData::CustomFormat>* custom_formats);
- virtual bool AreDropTypesRequired();
virtual bool CanDrop(const OSExchangeData& data);
virtual int OnDragUpdated(const views::DropTargetEvent& event);
virtual void OnDragExited();
diff --git a/chrome/browser/views/frame/browser_root_view.cc b/chrome/browser/views/frame/browser_root_view.cc
index 753a3314..5e471c6 100644
--- a/chrome/browser/views/frame/browser_root_view.cc
+++ b/chrome/browser/views/frame/browser_root_view.cc
@@ -13,27 +13,18 @@
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) {
- return (tabstrip_ && tabstrip_->GetView()->IsVisible() &&
- !tabstrip_->IsAnimating());
+ can_drop_ = (tabstrip_ && tabstrip_->GetView()->IsVisible() &&
+ !tabstrip_->IsAnimating() && data.HasURL());
+ return can_drop_;
}
void BrowserRootView::OnDragEntered(const views::DropTargetEvent& event) {
- if (ShouldForwardToTabStrip(event)) {
+ if (can_drop_ && ShouldForwardToTabStrip(event)) {
forwarding_to_tab_strip_ = true;
scoped_ptr<views::DropTargetEvent> mapped_event(MapEventToTabStrip(event));
tabstrip_->GetView()->OnDragEntered(*mapped_event.get());
@@ -41,17 +32,19 @@ void BrowserRootView::OnDragEntered(const views::DropTargetEvent& event) {
}
int BrowserRootView::OnDragUpdated(const views::DropTargetEvent& event) {
- 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;
+ 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();
}
- 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;
}
diff --git a/chrome/browser/views/frame/browser_root_view.h b/chrome/browser/views/frame/browser_root_view.h
index 5ead7cc..370ef5f 100644
--- a/chrome/browser/views/frame/browser_root_view.h
+++ b/chrome/browser/views/frame/browser_root_view.h
@@ -25,9 +25,6 @@ class BrowserRootView : public views::RootView {
// tabstrip set.
void set_tabstrip(TabStripWrapper* tabstrip) { tabstrip_ = tabstrip; }
- virtual bool GetDropFormats(
- int* formats,
- std::set<OSExchangeData::CustomFormat>* custom_formats);
virtual bool CanDrop(const OSExchangeData& data);
virtual void OnDragEntered(const views::DropTargetEvent& event);
virtual int OnDragUpdated(const views::DropTargetEvent& event);
@@ -46,6 +43,9 @@ class BrowserRootView : public views::RootView {
// The TabStrip.
TabStripWrapper* tabstrip_;
+ // Is a drop allowed? This is set by CanDrop.
+ bool can_drop_;
+
// If true, drag and drop events are being forwarded to the tab strip.
// This is used to determine when to send OnDragEntered and OnDragExited
// to the tab strip.
diff --git a/chrome/test/automated_ui_tests/automated_ui_test_base.cc b/chrome/test/automated_ui_tests/automated_ui_test_base.cc
index 981965d..4e842a2 100644
--- a/chrome/test/automated_ui_tests/automated_ui_test_base.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_test_base.cc
@@ -9,10 +9,7 @@
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/window_proxy.h"
#include "chrome/test/ui/ui_test.h"
-
-#if defined(TOOLKIT_VIEWS)
#include "views/view.h"
-#endif
AutomatedUITestBase::AutomatedUITestBase() {}
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc
index a2b6611..c29e2aa 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc
@@ -26,10 +26,7 @@
#include "chrome/test/automation/window_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "googleurl/src/gurl.h"
-
-#if defined(TOOLKIT_VIEWS)
#include "views/view.h"
-#endif
namespace {