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

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

Issue 396006: Revert 32012-32017 (Closed)
Patch Set: Created 11 years, 1 month 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"
42 #include "views/controls/menu/menu_item_view.h" 43 #include "views/controls/menu/menu_item_view.h"
43 #include "views/drag_utils.h" 44 #include "views/drag_utils.h"
44 #include "views/view_constants.h" 45 #include "views/view_constants.h"
45 #include "views/widget/tooltip_manager.h" 46 #include "views/widget/tooltip_manager.h"
46 #include "views/widget/widget.h" 47 #include "views/widget/widget.h"
47 #include "views/window/window.h" 48 #include "views/window/window.h"
48 49
49 using views::CustomButton; 50 using views::CustomButton;
50 using views::DropTargetEvent; 51 using views::DropTargetEvent;
51 using views::MenuButton; 52 using views::MenuButton;
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 } else if (drop_on) { 686 } else if (drop_on) {
686 parent_node = root->GetChild(index); 687 parent_node = root->GetChild(index);
687 index = parent_node->GetChildCount(); 688 index = parent_node->GetChildCount();
688 } else { 689 } else {
689 parent_node = root; 690 parent_node = root;
690 } 691 }
691 return bookmark_utils::PerformBookmarkDrop(profile_, data, parent_node, 692 return bookmark_utils::PerformBookmarkDrop(profile_, data, parent_node,
692 index); 693 index);
693 } 694 }
694 695
695 bool BookmarkBarView::IsAccessibleViewTraversable(views::View* view) { 696 bool BookmarkBarView::GetAccessibleName(std::wstring* name) {
696 return view != bookmarks_separator_view_ && view != instructions_; 697 DCHECK(name);
698
699 if (!accessible_name_.empty()) {
700 name->assign(accessible_name_);
701 return true;
702 }
703 return false;
704 }
705
706 bool BookmarkBarView::GetAccessibleRole(AccessibilityTypes::Role* role) {
707 DCHECK(role);
708
709 *role = AccessibilityTypes::ROLE_TOOLBAR;
710 return true;
711 }
712
713 void BookmarkBarView::SetAccessibleName(const std::wstring& name) {
714 accessible_name_.assign(name);
697 } 715 }
698 716
699 void BookmarkBarView::OnStateChanged() { 717 void BookmarkBarView::OnStateChanged() {
700 // When the sync state changes, it is sufficient to invoke View::Layout since 718 // When the sync state changes, it is sufficient to invoke View::Layout since
701 // during layout we query the profile sync service and determine whether the 719 // during layout we query the profile sync service and determine whether the
702 // new state requires showing the sync error button so that the user can 720 // new state requires showing the sync error button so that the user can
703 // re-enter her password. If extension shelf appears along with the bookmark 721 // re-enter her password. If extension shelf appears along with the bookmark
704 // shelf, it too needs to be layed out. Since both have the same parent, it is 722 // shelf, it too needs to be layed out. Since both have the same parent, it is
705 // enough to let the parent layout both of these children. 723 // enough to let the parent layout both of these children.
706 // TODO(sky): This should not require Layout() and SchedulePaint(). Needs 724 // TODO(sky): This should not require Layout() and SchedulePaint(). Needs
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 // Note that at this point we're not in a hierarchy so GetThemeProvider() will 864 // Note that at this point we're not in a hierarchy so GetThemeProvider() will
847 // return NULL. When we're inserted into a hierarchy, we'll call 865 // return NULL. When we're inserted into a hierarchy, we'll call
848 // UpdateColors(), which will set the appropriate colors for all the objects 866 // UpdateColors(), which will set the appropriate colors for all the objects
849 // added in this function. 867 // added in this function.
850 868
851 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 869 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
852 870
853 if (!kDefaultFavIcon) 871 if (!kDefaultFavIcon)
854 kDefaultFavIcon = rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); 872 kDefaultFavIcon = rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
855 873
856 // Child views are traversed in the order they are added. Make sure the order 874 other_bookmarked_button_ = CreateOtherBookmarkedButton();
857 // they are added matches the visual order. 875 AddChildView(other_bookmarked_button_);
876
858 sync_error_button_ = CreateSyncErrorButton(); 877 sync_error_button_ = CreateSyncErrorButton();
859 AddChildView(sync_error_button_); 878 AddChildView(sync_error_button_);
860 879
861 overflow_button_ = CreateOverflowButton(); 880 overflow_button_ = CreateOverflowButton();
862 AddChildView(overflow_button_); 881 AddChildView(overflow_button_);
863 882
864 other_bookmarked_button_ = CreateOtherBookmarkedButton();
865 AddChildView(other_bookmarked_button_);
866
867 bookmarks_separator_view_ = new ButtonSeparatorView(); 883 bookmarks_separator_view_ = new ButtonSeparatorView();
868 bookmarks_separator_view_->SetAccessibleName( 884 bookmarks_separator_view_->SetAccessibleName(
869 l10n_util::GetString(IDS_ACCNAME_SEPARATOR)); 885 l10n_util::GetString(IDS_ACCNAME_SEPARATOR));
870 AddChildView(bookmarks_separator_view_); 886 AddChildView(bookmarks_separator_view_);
871 887
872 instructions_ = new views::Label( 888 instructions_ = new views::Label(
873 l10n_util::GetString(IDS_BOOKMARKS_NO_ITEMS), 889 l10n_util::GetString(IDS_BOOKMARKS_NO_ITEMS),
874 rb.GetFont(ResourceBundle::BaseFont)); 890 rb.GetFont(ResourceBundle::BaseFont));
875 891
876 AddChildView(instructions_); 892 AddChildView(instructions_);
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 // The tooltip is the only way we have to display text explaining the error 1706 // The tooltip is the only way we have to display text explaining the error
1691 // to the user. 1707 // to the user.
1692 sync_error_button->SetTooltipText( 1708 sync_error_button->SetTooltipText(
1693 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); 1709 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC));
1694 sync_error_button->SetAccessibleName( 1710 sync_error_button->SetAccessibleName(
1695 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); 1711 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON));
1696 sync_error_button->SetIcon( 1712 sync_error_button->SetIcon(
1697 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); 1713 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING));
1698 return sync_error_button; 1714 return sync_error_button;
1699 } 1715 }
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