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

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

Issue 416903002: Revert 285142 "Open the WrenchMenu on mouseover when dragging a ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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 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
277 void BrowserActionsContainer::AddObserver( 268 void BrowserActionsContainer::AddObserver(
278 BrowserActionsContainerObserver* observer) { 269 BrowserActionsContainerObserver* observer) {
279 observers_.AddObserver(observer); 270 observers_.AddObserver(observer);
280 } 271 }
281 272
282 void BrowserActionsContainer::RemoveObserver( 273 void BrowserActionsContainer::RemoveObserver(
283 BrowserActionsContainerObserver* observer) { 274 BrowserActionsContainerObserver* observer) {
284 observers_.RemoveObserver(observer); 275 observers_.RemoveObserver(observer);
285 } 276 }
286 277
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 view->SetVisible(x + icon_width <= max_x); 366 view->SetVisible(x + icon_width <= max_x);
376 if (view->visible()) 367 if (view->visible())
377 view->SetBounds(x, 0, icon_width, IconHeight()); 368 view->SetBounds(x, 0, icon_width, IconHeight());
378 } 369 }
379 } 370 }
380 } 371 }
381 372
382 bool BrowserActionsContainer::GetDropFormats( 373 bool BrowserActionsContainer::GetDropFormats(
383 int* formats, 374 int* formats,
384 std::set<OSExchangeData::CustomFormat>* custom_formats) { 375 std::set<OSExchangeData::CustomFormat>* custom_formats) {
385 return BrowserActionDragData::GetDropFormats(custom_formats); 376 custom_formats->insert(BrowserActionDragData::GetBrowserActionCustomFormat());
377
378 return true;
386 } 379 }
387 380
388 bool BrowserActionsContainer::AreDropTypesRequired() { 381 bool BrowserActionsContainer::AreDropTypesRequired() {
389 return BrowserActionDragData::AreDropTypesRequired(); 382 return true;
390 } 383 }
391 384
392 bool BrowserActionsContainer::CanDrop(const OSExchangeData& data) { 385 bool BrowserActionsContainer::CanDrop(const OSExchangeData& data) {
393 return BrowserActionDragData::CanDrop(data, profile_); 386 BrowserActionDragData drop_data;
387 return drop_data.Read(data) ? drop_data.IsFromProfile(profile_) : false;
394 } 388 }
395 389
396 void BrowserActionsContainer::OnDragEntered( 390 void BrowserActionsContainer::OnDragEntered(
397 const ui::DropTargetEvent& event) { 391 const ui::DropTargetEvent& event) {
398 } 392 }
399 393
400 int BrowserActionsContainer::OnDragUpdated( 394 int BrowserActionsContainer::OnDragUpdated(
401 const ui::DropTargetEvent& event) { 395 const ui::DropTargetEvent& event) {
402 // First check if we are above the chevron (overflow) menu. 396 // First check if we are above the chevron (overflow) menu.
403 if (GetEventHandlerForPoint(event.location()) == chevron_) { 397 if (GetEventHandlerForPoint(event.location()) == chevron_) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 if (i > data.index()) 492 if (i > data.index())
499 --i; 493 --i;
500 494
501 if (profile_->IsOffTheRecord()) 495 if (profile_->IsOffTheRecord())
502 i = model_->IncognitoIndexToOriginal(i); 496 i = model_->IncognitoIndexToOriginal(i);
503 497
504 model_->MoveBrowserAction( 498 model_->MoveBrowserAction(
505 browser_action_views_[data.index()]->button()->extension(), i); 499 browser_action_views_[data.index()]->button()->extension(), i);
506 500
507 OnDragExited(); // Perform clean up after dragging. 501 OnDragExited(); // Perform clean up after dragging.
508 FOR_EACH_OBSERVER(BrowserActionsContainerObserver,
509 observers_,
510 OnBrowserActionDragDone());
511 return ui::DragDropTypes::DRAG_MOVE; 502 return ui::DragDropTypes::DRAG_MOVE;
512 } 503 }
513 504
514 void BrowserActionsContainer::GetAccessibleState( 505 void BrowserActionsContainer::GetAccessibleState(
515 ui::AXViewState* state) { 506 ui::AXViewState* state) {
516 state->role = ui::AX_ROLE_GROUP; 507 state->role = ui::AX_ROLE_GROUP;
517 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS); 508 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS);
518 } 509 }
519 510
520 void BrowserActionsContainer::OnMenuButtonClicked(views::View* source, 511 void BrowserActionsContainer::OnMenuButtonClicked(views::View* source,
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 views::BubbleBorder::TOP_RIGHT, 1055 views::BubbleBorder::TOP_RIGHT,
1065 show_action); 1056 show_action);
1066 popup_->GetWidget()->AddObserver(this); 1057 popup_->GetWidget()->AddObserver(this);
1067 popup_button_ = button; 1058 popup_button_ = button;
1068 1059
1069 // Only set button as pushed if it was triggered by a user click. 1060 // Only set button as pushed if it was triggered by a user click.
1070 if (should_grant) 1061 if (should_grant)
1071 popup_button_->SetButtonPushed(); 1062 popup_button_->SetButtonPushed();
1072 return true; 1063 return true;
1073 } 1064 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698