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/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/browser_actions_container.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 bool BrowserActionsContainer::AreDropTypesRequired() { | 239 bool BrowserActionsContainer::AreDropTypesRequired() { |
240 return true; | 240 return true; |
241 } | 241 } |
242 | 242 |
243 bool BrowserActionsContainer::CanDrop(const OSExchangeData& data) { | 243 bool BrowserActionsContainer::CanDrop(const OSExchangeData& data) { |
244 BrowserActionDragData drop_data; | 244 BrowserActionDragData drop_data; |
245 return drop_data.Read(data) ? drop_data.IsFromProfile(profile_) : false; | 245 return drop_data.Read(data) ? drop_data.IsFromProfile(profile_) : false; |
246 } | 246 } |
247 | 247 |
248 void BrowserActionsContainer::OnDragEntered( | 248 void BrowserActionsContainer::OnDragEntered( |
249 const views::DropTargetEvent& event) { | 249 const ui::DropTargetEvent& event) { |
250 } | 250 } |
251 | 251 |
252 int BrowserActionsContainer::OnDragUpdated( | 252 int BrowserActionsContainer::OnDragUpdated( |
253 const views::DropTargetEvent& event) { | 253 const ui::DropTargetEvent& event) { |
254 // First check if we are above the chevron (overflow) menu. | 254 // First check if we are above the chevron (overflow) menu. |
255 if (GetEventHandlerForPoint(event.location()) == chevron_) { | 255 if (GetEventHandlerForPoint(event.location()) == chevron_) { |
256 if (!show_menu_task_factory_.HasWeakPtrs() && !overflow_menu_) | 256 if (!show_menu_task_factory_.HasWeakPtrs() && !overflow_menu_) |
257 StartShowFolderDropMenuTimer(); | 257 StartShowFolderDropMenuTimer(); |
258 return ui::DragDropTypes::DRAG_MOVE; | 258 return ui::DragDropTypes::DRAG_MOVE; |
259 } | 259 } |
260 StopShowFolderDropMenuTimer(); | 260 StopShowFolderDropMenuTimer(); |
261 | 261 |
262 // Figure out where to display the indicator. This is a complex calculation: | 262 // Figure out where to display the indicator. This is a complex calculation: |
263 | 263 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 return ui::DragDropTypes::DRAG_MOVE; | 308 return ui::DragDropTypes::DRAG_MOVE; |
309 } | 309 } |
310 | 310 |
311 void BrowserActionsContainer::OnDragExited() { | 311 void BrowserActionsContainer::OnDragExited() { |
312 StopShowFolderDropMenuTimer(); | 312 StopShowFolderDropMenuTimer(); |
313 drop_indicator_position_ = -1; | 313 drop_indicator_position_ = -1; |
314 SchedulePaint(); | 314 SchedulePaint(); |
315 } | 315 } |
316 | 316 |
317 int BrowserActionsContainer::OnPerformDrop( | 317 int BrowserActionsContainer::OnPerformDrop( |
318 const views::DropTargetEvent& event) { | 318 const ui::DropTargetEvent& event) { |
319 BrowserActionDragData data; | 319 BrowserActionDragData data; |
320 if (!data.Read(event.data())) | 320 if (!data.Read(event.data())) |
321 return ui::DragDropTypes::DRAG_NONE; | 321 return ui::DragDropTypes::DRAG_NONE; |
322 | 322 |
323 // Make sure we have the same view as we started with. | 323 // Make sure we have the same view as we started with. |
324 DCHECK_EQ(browser_action_views_[data.index()]->button()->extension()->id(), | 324 DCHECK_EQ(browser_action_views_[data.index()]->button()->extension()->id(), |
325 data.id()); | 325 data.id()); |
326 DCHECK(model_); | 326 DCHECK(model_); |
327 | 327 |
328 size_t i = 0; | 328 size_t i = 0; |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 views::BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? | 809 views::BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? |
810 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; | 810 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; |
811 popup_ = ExtensionPopup::ShowPopup(popup_url, | 811 popup_ = ExtensionPopup::ShowPopup(popup_url, |
812 browser_, | 812 browser_, |
813 reference_view, | 813 reference_view, |
814 arrow_location); | 814 arrow_location); |
815 popup_->GetWidget()->AddObserver(this); | 815 popup_->GetWidget()->AddObserver(this); |
816 popup_button_ = button; | 816 popup_button_ = button; |
817 popup_button_->SetButtonPushed(); | 817 popup_button_->SetButtonPushed(); |
818 } | 818 } |
OLD | NEW |