| 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" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 13 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 14 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/test/interactive_ui/view_event_test_base.h" | 16 #include "chrome/test/interactive_ui/view_event_test_base.h" |
| 16 #include "chrome/test/testing_profile.h" | 17 #include "chrome/test/testing_profile.h" |
| 17 #include "chrome/test/ui_test_utils.h" | 18 #include "chrome/test/ui_test_utils.h" |
| 18 #include "content/browser/tab_contents/page_navigator.h" | 19 #include "content/browser/tab_contents/page_navigator.h" |
| 19 #include "content/common/notification_service.h" | 20 #include "content/common/notification_service.h" |
| 20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 21 #include "ui/base/accessibility/accessibility_types.h" | 22 #include "ui/base/accessibility/accessibility_types.h" |
| 22 #include "ui/base/clipboard/clipboard.h" | 23 #include "ui/base/clipboard/clipboard.h" |
| 23 #include "ui/base/keycodes/keyboard_codes.h" | 24 #include "ui/base/keycodes/keyboard_codes.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 454 |
| 454 VIEW_TEST(BookmarkBarViewTest3, Submenus) | 455 VIEW_TEST(BookmarkBarViewTest3, Submenus) |
| 455 | 456 |
| 456 // Observer that posts task upon the context menu creation. | 457 // Observer that posts task upon the context menu creation. |
| 457 // This is necessary for Linux as the context menu has to check | 458 // This is necessary for Linux as the context menu has to check |
| 458 // the clipboard, which invokes the event loop. | 459 // the clipboard, which invokes the event loop. |
| 459 class ContextMenuNotificationObserver : public NotificationObserver { | 460 class ContextMenuNotificationObserver : public NotificationObserver { |
| 460 public: | 461 public: |
| 461 explicit ContextMenuNotificationObserver(Task* task) : task_(task) { | 462 explicit ContextMenuNotificationObserver(Task* task) : task_(task) { |
| 462 registrar_.Add(this, | 463 registrar_.Add(this, |
| 463 NotificationType::BOOKMARK_CONTEXT_MENU_SHOWN, | 464 chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, |
| 464 NotificationService::AllSources()); | 465 NotificationService::AllSources()); |
| 465 } | 466 } |
| 466 | 467 |
| 467 virtual void Observe(NotificationType type, | 468 virtual void Observe(int type, |
| 468 const NotificationSource& source, | 469 const NotificationSource& source, |
| 469 const NotificationDetails& details) { | 470 const NotificationDetails& details) { |
| 470 MessageLoop::current()->PostTask(FROM_HERE, task_); | 471 MessageLoop::current()->PostTask(FROM_HERE, task_); |
| 471 } | 472 } |
| 472 | 473 |
| 473 // Sets the task that is posted when the context menu is shown. | 474 // Sets the task that is posted when the context menu is shown. |
| 474 void set_task(Task* task) { task_ = task; } | 475 void set_task(Task* task) { task_ = task; } |
| 475 | 476 |
| 476 private: | 477 private: |
| 477 NotificationRegistrar registrar_; | 478 NotificationRegistrar registrar_; |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 | 1446 |
| 1446 bb_view_->GetMenu()->GetMenuController()->CancelAll(); | 1447 bb_view_->GetMenu()->GetMenuController()->CancelAll(); |
| 1447 | 1448 |
| 1448 Done(); | 1449 Done(); |
| 1449 } | 1450 } |
| 1450 | 1451 |
| 1451 ContextMenuNotificationObserver observer_; | 1452 ContextMenuNotificationObserver observer_; |
| 1452 }; | 1453 }; |
| 1453 | 1454 |
| 1454 VIEW_TEST(BookmarkBarViewTest17, ContextMenus3) | 1455 VIEW_TEST(BookmarkBarViewTest17, ContextMenus3) |
| OLD | NEW |