OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 *formats = ui::OSExchangeData::URL | ui::OSExchangeData::STRING; | 803 *formats = ui::OSExchangeData::URL | ui::OSExchangeData::STRING; |
804 return true; | 804 return true; |
805 } | 805 } |
806 | 806 |
807 bool ToolbarView::CanDrop(const ui::OSExchangeData& data) { | 807 bool ToolbarView::CanDrop(const ui::OSExchangeData& data) { |
808 // To support loading URLs by dropping into the toolbar, we need to support | 808 // To support loading URLs by dropping into the toolbar, we need to support |
809 // dropping URLs and/or text. | 809 // dropping URLs and/or text. |
810 return data.HasURL() || data.HasString(); | 810 return data.HasURL() || data.HasString(); |
811 } | 811 } |
812 | 812 |
813 int ToolbarView::OnDragUpdated(const views::DropTargetEvent& event) { | 813 int ToolbarView::OnDragUpdated(const ui::DropTargetEvent& event) { |
814 if (event.source_operations() & ui::DragDropTypes::DRAG_COPY) { | 814 if (event.source_operations() & ui::DragDropTypes::DRAG_COPY) { |
815 return ui::DragDropTypes::DRAG_COPY; | 815 return ui::DragDropTypes::DRAG_COPY; |
816 } else if (event.source_operations() & ui::DragDropTypes::DRAG_LINK) { | 816 } else if (event.source_operations() & ui::DragDropTypes::DRAG_LINK) { |
817 return ui::DragDropTypes::DRAG_LINK; | 817 return ui::DragDropTypes::DRAG_LINK; |
818 } | 818 } |
819 return ui::DragDropTypes::DRAG_NONE; | 819 return ui::DragDropTypes::DRAG_NONE; |
820 } | 820 } |
821 | 821 |
822 int ToolbarView::OnPerformDrop(const views::DropTargetEvent& event) { | 822 int ToolbarView::OnPerformDrop(const ui::DropTargetEvent& event) { |
823 return location_bar_->GetLocationEntry()->OnPerformDrop(event); | 823 return location_bar_->GetLocationEntry()->OnPerformDrop(event); |
824 } | 824 } |
825 | 825 |
826 void ToolbarView::OnThemeChanged() { | 826 void ToolbarView::OnThemeChanged() { |
827 LoadImages(); | 827 LoadImages(); |
828 } | 828 } |
829 | 829 |
830 std::string ToolbarView::GetClassName() const { | 830 std::string ToolbarView::GetClassName() const { |
831 return kViewClassName; | 831 return kViewClassName; |
832 } | 832 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 // LocationBarContainer is not a child of the ToolbarView. | 1012 // LocationBarContainer is not a child of the ToolbarView. |
1013 gfx::Point origin(bounds.origin()); | 1013 gfx::Point origin(bounds.origin()); |
1014 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), | 1014 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), |
1015 &origin); | 1015 &origin); |
1016 gfx::Rect target_bounds(origin, bounds.size()); | 1016 gfx::Rect target_bounds(origin, bounds.size()); |
1017 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1017 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
1018 location_bar_container_->SetInToolbar(true); | 1018 location_bar_container_->SetInToolbar(true); |
1019 location_bar_container_->SetBoundsRect(target_bounds); | 1019 location_bar_container_->SetBoundsRect(target_bounds); |
1020 } | 1020 } |
1021 } | 1021 } |
OLD | NEW |