OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 node = model_->bookmark_bar_node(); | 1228 node = model_->bookmark_bar_node(); |
1229 start_index = GetFirstHiddenNodeIndex(); | 1229 start_index = GetFirstHiddenNodeIndex(); |
1230 } else { | 1230 } else { |
1231 int button_index = GetIndexOf(view); | 1231 int button_index = GetIndexOf(view); |
1232 DCHECK_NE(-1, button_index); | 1232 DCHECK_NE(-1, button_index); |
1233 node = model_->bookmark_bar_node()->GetChild(button_index); | 1233 node = model_->bookmark_bar_node()->GetChild(button_index); |
1234 } | 1234 } |
1235 | 1235 |
1236 RecordBookmarkFolderOpen(GetBookmarkLaunchLocation()); | 1236 RecordBookmarkFolderOpen(GetBookmarkLaunchLocation()); |
1237 bookmark_menu_ = new BookmarkMenuController( | 1237 bookmark_menu_ = new BookmarkMenuController( |
1238 browser_, page_navigator_, GetWidget(), node, start_index); | 1238 browser_, page_navigator_, GetWidget(), node, start_index, false); |
1239 bookmark_menu_->set_observer(this); | 1239 bookmark_menu_->set_observer(this); |
1240 bookmark_menu_->RunMenuAt(this, false); | 1240 bookmark_menu_->RunMenuAt(this); |
1241 } | 1241 } |
1242 | 1242 |
1243 void BookmarkBarView::ButtonPressed(views::Button* sender, | 1243 void BookmarkBarView::ButtonPressed(views::Button* sender, |
1244 const ui::Event& event) { | 1244 const ui::Event& event) { |
1245 WindowOpenDisposition disposition_from_event_flags = | 1245 WindowOpenDisposition disposition_from_event_flags = |
1246 ui::DispositionFromEventFlags(event.flags()); | 1246 ui::DispositionFromEventFlags(event.flags()); |
1247 | 1247 |
1248 if (sender->tag() == kAppsShortcutButtonTag) { | 1248 if (sender->tag() == kAppsShortcutButtonTag) { |
1249 OpenURLParams params(GURL(chrome::kChromeUIAppsURL), | 1249 OpenURLParams params(GURL(chrome::kChromeUIAppsURL), |
1250 Referrer(), | 1250 Referrer(), |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 | 1591 |
1592 views::MenuButton* menu_button = GetMenuButtonForNode(node); | 1592 views::MenuButton* menu_button = GetMenuButtonForNode(node); |
1593 if (!menu_button) | 1593 if (!menu_button) |
1594 return; | 1594 return; |
1595 | 1595 |
1596 int start_index = 0; | 1596 int start_index = 0; |
1597 if (node == model_->bookmark_bar_node()) | 1597 if (node == model_->bookmark_bar_node()) |
1598 start_index = GetFirstHiddenNodeIndex(); | 1598 start_index = GetFirstHiddenNodeIndex(); |
1599 | 1599 |
1600 drop_info_->is_menu_showing = true; | 1600 drop_info_->is_menu_showing = true; |
1601 bookmark_drop_menu_ = new BookmarkMenuController(browser_, | 1601 bookmark_drop_menu_ = new BookmarkMenuController( |
1602 page_navigator_, GetWidget(), node, start_index); | 1602 browser_, page_navigator_, GetWidget(), node, start_index, true); |
1603 bookmark_drop_menu_->set_observer(this); | 1603 bookmark_drop_menu_->set_observer(this); |
1604 bookmark_drop_menu_->RunMenuAt(this, true); | 1604 bookmark_drop_menu_->RunMenuAt(this); |
1605 } | 1605 } |
1606 | 1606 |
1607 void BookmarkBarView::StopShowFolderDropMenuTimer() { | 1607 void BookmarkBarView::StopShowFolderDropMenuTimer() { |
1608 show_folder_method_factory_.InvalidateWeakPtrs(); | 1608 show_folder_method_factory_.InvalidateWeakPtrs(); |
1609 } | 1609 } |
1610 | 1610 |
1611 void BookmarkBarView::StartShowFolderDropMenuTimer(const BookmarkNode* node) { | 1611 void BookmarkBarView::StartShowFolderDropMenuTimer(const BookmarkNode* node) { |
1612 if (!animations_enabled) { | 1612 if (!animations_enabled) { |
1613 // So that tests can run as fast as possible disable the delay during | 1613 // So that tests can run as fast as possible disable the delay during |
1614 // testing. | 1614 // testing. |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1954 DCHECK(apps_page_shortcut_); | 1954 DCHECK(apps_page_shortcut_); |
1955 // Only perform layout if required. | 1955 // Only perform layout if required. |
1956 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( | 1956 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( |
1957 browser_->profile(), browser_->host_desktop_type()); | 1957 browser_->profile(), browser_->host_desktop_type()); |
1958 if (apps_page_shortcut_->visible() == visible) | 1958 if (apps_page_shortcut_->visible() == visible) |
1959 return; | 1959 return; |
1960 apps_page_shortcut_->SetVisible(visible); | 1960 apps_page_shortcut_->SetVisible(visible); |
1961 UpdateBookmarksSeparatorVisibility(); | 1961 UpdateBookmarksSeparatorVisibility(); |
1962 Layout(); | 1962 Layout(); |
1963 } | 1963 } |
OLD | NEW |