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

Side by Side Diff: chrome/browser/ui/views/toolbar_view.cc

Issue 6462009: Allow dragging and dropping of URLs to any portion of the toolbar view.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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/ui/views/toolbar_view.h" 5 #include "chrome/browser/ui/views/toolbar_view.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/accessibility/browser_accessibility_state.h" 10 #include "chrome/browser/accessibility/browser_accessibility_state.h"
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 width() - kPopupBackgroundEdge->width(), top_spacing); 600 width() - kPopupBackgroundEdge->width(), top_spacing);
601 } 601 }
602 602
603 // For glass, we need to draw a black line below the location bar to separate 603 // For glass, we need to draw a black line below the location bar to separate
604 // it from the content area. For non-glass, the NonClientView draws the 604 // it from the content area. For non-glass, the NonClientView draws the
605 // toolbar background below the location bar for us. 605 // toolbar background below the location bar for us.
606 if (GetWindow()->GetNonClientView()->UseNativeFrame()) 606 if (GetWindow()->GetNonClientView()->UseNativeFrame())
607 canvas->FillRectInt(SK_ColorBLACK, 0, height() - 1, width(), 1); 607 canvas->FillRectInt(SK_ColorBLACK, 0, height() - 1, width(), 1);
608 } 608 }
609 609
610 bool ToolbarView::CanDrop(const ui::OSExchangeData& data) {
611 // To support loading URLs by dropping into the toolbar, we need to support
612 // dropping URLs and/or text.
613 return data.HasURL() || data.HasString();
614 }
615
616 int ToolbarView::OnDragUpdated(const views::DropTargetEvent& event) {
617 return ui::DragDropTypes::DRAG_COPY;
sky 2011/02/11 01:06:07 I think you should allow move or link too. But, yo
Roger Tawa OOO till Jul 10th 2011/02/11 15:20:17 Changed to support either copy or link, just like
sky 2011/02/11 17:14:53 Fair enough, but shouldn't we ignore the drop enti
Roger Tawa OOO till Jul 10th 2011/02/11 21:35:26 If the drop is on the edit itself, it uses its own
sky 2011/02/11 23:18:50 If you drag the url from the omnibox it won't allo
618 }
619
620 int ToolbarView::OnPerformDrop(const views::DropTargetEvent& event) {
621 return location_bar_->location_entry()->OnPerformDrop(event);
622 }
623
610 void ToolbarView::OnThemeChanged() { 624 void ToolbarView::OnThemeChanged() {
611 LoadImages(); 625 LoadImages();
612 } 626 }
613 627
614 //////////////////////////////////////////////////////////////////////////////// 628 ////////////////////////////////////////////////////////////////////////////////
615 // ToolbarView, protected: 629 // ToolbarView, protected:
616 630
617 // Override this so that when the user presses F6 to rotate toolbar panes, 631 // Override this so that when the user presses F6 to rotate toolbar panes,
618 // the location bar gets focus, not the first control in the toolbar. 632 // the location bar gets focus, not the first control in the toolbar.
619 views::View* ToolbarView::GetDefaultFocusableChild() { 633 views::View* ToolbarView::GetDefaultFocusableChild() {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 NOTREACHED(); 780 NOTREACHED();
767 #endif 781 #endif
768 } else { 782 } else {
769 NOTREACHED(); 783 NOTREACHED();
770 } 784 }
771 785
772 canvas->DrawBitmapInt(badge, icon.width() - badge.width(), kBadgeTopMargin); 786 canvas->DrawBitmapInt(badge, icon.width() - badge.width(), kBadgeTopMargin);
773 787
774 return canvas->ExtractBitmap(); 788 return canvas->ExtractBitmap();
775 } 789 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698