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

Side by Side Diff: chrome/browser/views/bookmark_bar_view.cc

Issue 333010: Implement keyboard access between bookmarks and toolbar. (Closed)
Patch Set: Add more null checks Created 11 years 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/bookmark_bar_view.h" 5 #include "chrome/browser/views/bookmark_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/views/location_bar_view.h" 32 #include "chrome/browser/views/location_bar_view.h"
33 #include "chrome/common/notification_service.h" 33 #include "chrome/common/notification_service.h"
34 #include "chrome/common/page_transition_types.h" 34 #include "chrome/common/page_transition_types.h"
35 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
36 #include "chrome/common/pref_service.h" 36 #include "chrome/common/pref_service.h"
37 #include "grit/app_resources.h" 37 #include "grit/app_resources.h"
38 #include "grit/generated_resources.h" 38 #include "grit/generated_resources.h"
39 #include "grit/theme_resources.h" 39 #include "grit/theme_resources.h"
40 #include "views/controls/button/menu_button.h" 40 #include "views/controls/button/menu_button.h"
41 #include "views/controls/label.h" 41 #include "views/controls/label.h"
42 #include "views/controls/button/menu_button.h"
43 #include "views/controls/menu/menu_item_view.h" 42 #include "views/controls/menu/menu_item_view.h"
44 #include "views/drag_utils.h" 43 #include "views/drag_utils.h"
45 #include "views/view_constants.h" 44 #include "views/view_constants.h"
46 #include "views/widget/tooltip_manager.h" 45 #include "views/widget/tooltip_manager.h"
47 #include "views/widget/widget.h" 46 #include "views/widget/widget.h"
48 #include "views/window/window.h" 47 #include "views/window/window.h"
49 48
50 #if defined(OS_WIN) 49 #if defined(OS_WIN)
51 #include "chrome/browser/views/importer_view.h" 50 #include "chrome/browser/views/importer_view.h"
52 #endif 51 #endif
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 } else if (drop_on) { 708 } else if (drop_on) {
710 parent_node = root->GetChild(index); 709 parent_node = root->GetChild(index);
711 index = parent_node->GetChildCount(); 710 index = parent_node->GetChildCount();
712 } else { 711 } else {
713 parent_node = root; 712 parent_node = root;
714 } 713 }
715 return bookmark_utils::PerformBookmarkDrop(profile_, data, parent_node, 714 return bookmark_utils::PerformBookmarkDrop(profile_, data, parent_node,
716 index); 715 index);
717 } 716 }
718 717
719 bool BookmarkBarView::GetAccessibleName(std::wstring* name) { 718 bool BookmarkBarView::IsAccessibleViewTraversable(views::View* view) {
720 DCHECK(name); 719 return view != bookmarks_separator_view_ && view != instructions_;
721
722 if (!accessible_name_.empty()) {
723 name->assign(accessible_name_);
724 return true;
725 }
726 return false;
727 }
728
729 bool BookmarkBarView::GetAccessibleRole(AccessibilityTypes::Role* role) {
730 DCHECK(role);
731
732 *role = AccessibilityTypes::ROLE_TOOLBAR;
733 return true;
734 }
735
736 void BookmarkBarView::SetAccessibleName(const std::wstring& name) {
737 accessible_name_.assign(name);
738 } 720 }
739 721
740 void BookmarkBarView::OnStateChanged() { 722 void BookmarkBarView::OnStateChanged() {
741 // When the sync state changes, it is sufficient to invoke View::Layout since 723 // When the sync state changes, it is sufficient to invoke View::Layout since
742 // during layout we query the profile sync service and determine whether the 724 // during layout we query the profile sync service and determine whether the
743 // new state requires showing the sync error button so that the user can 725 // new state requires showing the sync error button so that the user can
744 // re-enter her password. If extension shelf appears along with the bookmark 726 // re-enter her password. If extension shelf appears along with the bookmark
745 // shelf, it too needs to be layed out. Since both have the same parent, it is 727 // shelf, it too needs to be layed out. Since both have the same parent, it is
746 // enough to let the parent layout both of these children. 728 // enough to let the parent layout both of these children.
747 // TODO(sky): This should not require Layout() and SchedulePaint(). Needs 729 // TODO(sky): This should not require Layout() and SchedulePaint(). Needs
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 // Note that at this point we're not in a hierarchy so GetThemeProvider() will 878 // Note that at this point we're not in a hierarchy so GetThemeProvider() will
897 // return NULL. When we're inserted into a hierarchy, we'll call 879 // return NULL. When we're inserted into a hierarchy, we'll call
898 // UpdateColors(), which will set the appropriate colors for all the objects 880 // UpdateColors(), which will set the appropriate colors for all the objects
899 // added in this function. 881 // added in this function.
900 882
901 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 883 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
902 884
903 if (!kDefaultFavIcon) 885 if (!kDefaultFavIcon)
904 kDefaultFavIcon = rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); 886 kDefaultFavIcon = rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
905 887
906 other_bookmarked_button_ = CreateOtherBookmarkedButton(); 888 // Child views are traversed in the order they are added. Make sure the order
907 AddChildView(other_bookmarked_button_); 889 // they are added matches the visual order.
908
909 sync_error_button_ = CreateSyncErrorButton(); 890 sync_error_button_ = CreateSyncErrorButton();
910 AddChildView(sync_error_button_); 891 AddChildView(sync_error_button_);
911 892
912 overflow_button_ = CreateOverflowButton(); 893 overflow_button_ = CreateOverflowButton();
913 AddChildView(overflow_button_); 894 AddChildView(overflow_button_);
914 895
896 other_bookmarked_button_ = CreateOtherBookmarkedButton();
897 AddChildView(other_bookmarked_button_);
898
915 bookmarks_separator_view_ = new ButtonSeparatorView(); 899 bookmarks_separator_view_ = new ButtonSeparatorView();
916 bookmarks_separator_view_->SetAccessibleName( 900 bookmarks_separator_view_->SetAccessibleName(
917 l10n_util::GetString(IDS_ACCNAME_SEPARATOR)); 901 l10n_util::GetString(IDS_ACCNAME_SEPARATOR));
918 AddChildView(bookmarks_separator_view_); 902 AddChildView(bookmarks_separator_view_);
919 903
920 instructions_ = new BookmarkBarInstructionsView(this); 904 instructions_ = new BookmarkBarInstructionsView(this);
921 AddChildView(instructions_); 905 AddChildView(instructions_);
922 906
923 SetContextMenuController(this); 907 SetContextMenuController(this);
924 908
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 // The tooltip is the only way we have to display text explaining the error 1713 // The tooltip is the only way we have to display text explaining the error
1730 // to the user. 1714 // to the user.
1731 sync_error_button->SetTooltipText( 1715 sync_error_button->SetTooltipText(
1732 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); 1716 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC));
1733 sync_error_button->SetAccessibleName( 1717 sync_error_button->SetAccessibleName(
1734 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); 1718 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON));
1735 sync_error_button->SetIcon( 1719 sync_error_button->SetIcon(
1736 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); 1720 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING));
1737 return sync_error_button; 1721 return sync_error_button;
1738 } 1722 }
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_bar_view.h ('k') | chrome/browser/views/detachable_toolbar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698