| OLD | NEW |
| 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 "base/string_number_conversions.h" | 5 #include "base/string_number_conversions.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/automation/ui_controls.h" | 8 #include "chrome/browser/automation/ui_controls.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 453 |
| 454 VIEW_TEST(BookmarkBarViewTest3, Submenus) | 454 VIEW_TEST(BookmarkBarViewTest3, Submenus) |
| 455 | 455 |
| 456 // Observer that posts task upon the context menu creation. | 456 // Observer that posts task upon the context menu creation. |
| 457 // This is necessary for Linux as the context menu has to check | 457 // This is necessary for Linux as the context menu has to check |
| 458 // the clipboard, which invokes the event loop. | 458 // the clipboard, which invokes the event loop. |
| 459 class ContextMenuNotificationObserver : public NotificationObserver { | 459 class ContextMenuNotificationObserver : public NotificationObserver { |
| 460 public: | 460 public: |
| 461 explicit ContextMenuNotificationObserver(Task* task) : task_(task) { | 461 explicit ContextMenuNotificationObserver(Task* task) : task_(task) { |
| 462 registrar_.Add(this, | 462 registrar_.Add(this, |
| 463 NotificationType::BOOKMARK_CONTEXT_MENU_SHOWN, | 463 chrome::BOOKMARK_CONTEXT_MENU_SHOWN, |
| 464 NotificationService::AllSources()); | 464 NotificationService::AllSources()); |
| 465 } | 465 } |
| 466 | 466 |
| 467 virtual void Observe(NotificationType type, | 467 virtual void Observe(int type, |
| 468 const NotificationSource& source, | 468 const NotificationSource& source, |
| 469 const NotificationDetails& details) { | 469 const NotificationDetails& details) { |
| 470 MessageLoop::current()->PostTask(FROM_HERE, task_); | 470 MessageLoop::current()->PostTask(FROM_HERE, task_); |
| 471 } | 471 } |
| 472 | 472 |
| 473 // Sets the task that is posted when the context menu is shown. | 473 // Sets the task that is posted when the context menu is shown. |
| 474 void set_task(Task* task) { task_ = task; } | 474 void set_task(Task* task) { task_ = task; } |
| 475 | 475 |
| 476 private: | 476 private: |
| 477 NotificationRegistrar registrar_; | 477 NotificationRegistrar registrar_; |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 | 1445 |
| 1446 bb_view_->GetMenu()->GetMenuController()->CancelAll(); | 1446 bb_view_->GetMenu()->GetMenuController()->CancelAll(); |
| 1447 | 1447 |
| 1448 Done(); | 1448 Done(); |
| 1449 } | 1449 } |
| 1450 | 1450 |
| 1451 ContextMenuNotificationObserver observer_; | 1451 ContextMenuNotificationObserver observer_; |
| 1452 }; | 1452 }; |
| 1453 | 1453 |
| 1454 VIEW_TEST(BookmarkBarViewTest17, ContextMenus3) | 1454 VIEW_TEST(BookmarkBarViewTest17, ContextMenus3) |
| OLD | NEW |