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

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_actions_container.cc

Issue 399143004: Open the WrenchMenu on mouseover when dragging a browser action (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Win/Test Fix Created 6 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser_actions_container.h" 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // instance. 258 // instance.
259 DCHECK(!command.global()); 259 DCHECK(!command.global());
260 extension_keybinding_registry_->ExecuteCommand(extension->id(), 260 extension_keybinding_registry_->ExecuteCommand(extension->id(),
261 command.accelerator()); 261 command.accelerator());
262 } 262 }
263 263
264 bool BrowserActionsContainer::ShownInsideMenu() const { 264 bool BrowserActionsContainer::ShownInsideMenu() const {
265 return in_overflow_mode(); 265 return in_overflow_mode();
266 } 266 }
267 267
268 void BrowserActionsContainer::OnBrowserActionViewDragDone() {
269 // We notify here as well as in OnPerformDrop because the dragged view is
270 // removed in OnPerformDrop, so it will never get its OnDragDone() call.
271 // TODO(devlin): we should see about fixing that.
272 FOR_EACH_OBSERVER(BrowserActionsContainerObserver,
273 observers_,
274 OnBrowserActionDragDone());
275 }
276
268 void BrowserActionsContainer::AddObserver( 277 void BrowserActionsContainer::AddObserver(
269 BrowserActionsContainerObserver* observer) { 278 BrowserActionsContainerObserver* observer) {
270 observers_.AddObserver(observer); 279 observers_.AddObserver(observer);
271 } 280 }
272 281
273 void BrowserActionsContainer::RemoveObserver( 282 void BrowserActionsContainer::RemoveObserver(
274 BrowserActionsContainerObserver* observer) { 283 BrowserActionsContainerObserver* observer) {
275 observers_.RemoveObserver(observer); 284 observers_.RemoveObserver(observer);
276 } 285 }
277 286
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 view->SetVisible(x + icon_width <= max_x); 375 view->SetVisible(x + icon_width <= max_x);
367 if (view->visible()) 376 if (view->visible())
368 view->SetBounds(x, 0, icon_width, IconHeight()); 377 view->SetBounds(x, 0, icon_width, IconHeight());
369 } 378 }
370 } 379 }
371 } 380 }
372 381
373 bool BrowserActionsContainer::GetDropFormats( 382 bool BrowserActionsContainer::GetDropFormats(
374 int* formats, 383 int* formats,
375 std::set<OSExchangeData::CustomFormat>* custom_formats) { 384 std::set<OSExchangeData::CustomFormat>* custom_formats) {
376 custom_formats->insert(BrowserActionDragData::GetBrowserActionCustomFormat()); 385 return BrowserActionDragData::GetDropFormats(custom_formats);
377
378 return true;
379 } 386 }
380 387
381 bool BrowserActionsContainer::AreDropTypesRequired() { 388 bool BrowserActionsContainer::AreDropTypesRequired() {
382 return true; 389 return BrowserActionDragData::AreDropTypesRequired();
383 } 390 }
384 391
385 bool BrowserActionsContainer::CanDrop(const OSExchangeData& data) { 392 bool BrowserActionsContainer::CanDrop(const OSExchangeData& data) {
386 BrowserActionDragData drop_data; 393 return BrowserActionDragData::CanDrop(data, profile_);
387 return drop_data.Read(data) ? drop_data.IsFromProfile(profile_) : false;
388 } 394 }
389 395
390 void BrowserActionsContainer::OnDragEntered( 396 void BrowserActionsContainer::OnDragEntered(
391 const ui::DropTargetEvent& event) { 397 const ui::DropTargetEvent& event) {
392 } 398 }
393 399
394 int BrowserActionsContainer::OnDragUpdated( 400 int BrowserActionsContainer::OnDragUpdated(
395 const ui::DropTargetEvent& event) { 401 const ui::DropTargetEvent& event) {
396 // First check if we are above the chevron (overflow) menu. 402 // First check if we are above the chevron (overflow) menu.
397 if (GetEventHandlerForPoint(event.location()) == chevron_) { 403 if (GetEventHandlerForPoint(event.location()) == chevron_) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 if (i > data.index()) 498 if (i > data.index())
493 --i; 499 --i;
494 500
495 if (profile_->IsOffTheRecord()) 501 if (profile_->IsOffTheRecord())
496 i = model_->IncognitoIndexToOriginal(i); 502 i = model_->IncognitoIndexToOriginal(i);
497 503
498 model_->MoveBrowserAction( 504 model_->MoveBrowserAction(
499 browser_action_views_[data.index()]->button()->extension(), i); 505 browser_action_views_[data.index()]->button()->extension(), i);
500 506
501 OnDragExited(); // Perform clean up after dragging. 507 OnDragExited(); // Perform clean up after dragging.
508 FOR_EACH_OBSERVER(BrowserActionsContainerObserver,
509 observers_,
510 OnBrowserActionDragDone());
502 return ui::DragDropTypes::DRAG_MOVE; 511 return ui::DragDropTypes::DRAG_MOVE;
503 } 512 }
504 513
505 void BrowserActionsContainer::GetAccessibleState( 514 void BrowserActionsContainer::GetAccessibleState(
506 ui::AXViewState* state) { 515 ui::AXViewState* state) {
507 state->role = ui::AX_ROLE_GROUP; 516 state->role = ui::AX_ROLE_GROUP;
508 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS); 517 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS);
509 } 518 }
510 519
511 void BrowserActionsContainer::OnMenuButtonClicked(views::View* source, 520 void BrowserActionsContainer::OnMenuButtonClicked(views::View* source,
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 views::BubbleBorder::TOP_RIGHT, 1064 views::BubbleBorder::TOP_RIGHT,
1056 show_action); 1065 show_action);
1057 popup_->GetWidget()->AddObserver(this); 1066 popup_->GetWidget()->AddObserver(this);
1058 popup_button_ = button; 1067 popup_button_ = button;
1059 1068
1060 // Only set button as pushed if it was triggered by a user click. 1069 // Only set button as pushed if it was triggered by a user click.
1061 if (should_grant) 1070 if (should_grant)
1062 popup_button_->SetButtonPushed(); 1071 popup_button_->SetButtonPushed();
1063 return true; 1072 return true;
1064 } 1073 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698