OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_menu_delegate.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
10 #include "chrome/browser/bookmarks/bookmark_stats.h" | 10 #include "chrome/browser/bookmarks/bookmark_stats.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 int next_menu_id() { return bookmark_menu_delegate_->next_menu_id_; } | 83 int next_menu_id() { return bookmark_menu_delegate_->next_menu_id_; } |
84 | 84 |
85 // Forces all the menus to load by way of invoking WillShowMenu() on all menu | 85 // Forces all the menus to load by way of invoking WillShowMenu() on all menu |
86 // items of tyep SUBMENU. | 86 // items of tyep SUBMENU. |
87 void LoadAllMenus() { LoadAllMenus(bookmark_menu_delegate_->menu()); } | 87 void LoadAllMenus() { LoadAllMenus(bookmark_menu_delegate_->menu()); } |
88 | 88 |
89 BookmarkModel* model_; | 89 BookmarkModel* model_; |
90 | 90 |
91 scoped_ptr<BookmarkMenuDelegate> bookmark_menu_delegate_; | 91 std::unique_ptr<BookmarkMenuDelegate> bookmark_menu_delegate_; |
92 | 92 |
93 private: | 93 private: |
94 void LoadAllMenus(views::MenuItemView* menu) { | 94 void LoadAllMenus(views::MenuItemView* menu) { |
95 EXPECT_EQ(views::MenuItemView::SUBMENU, menu->GetType()); | 95 EXPECT_EQ(views::MenuItemView::SUBMENU, menu->GetType()); |
96 | 96 |
97 for (int i = 0; i < menu->GetSubmenu()->GetMenuItemCount(); ++i) { | 97 for (int i = 0; i < menu->GetSubmenu()->GetMenuItemCount(); ++i) { |
98 views::MenuItemView* child = menu->GetSubmenu()->GetMenuItemAt(i); | 98 views::MenuItemView* child = menu->GetSubmenu()->GetMenuItemAt(i); |
99 if (child->GetType() == views::MenuItemView::SUBMENU) { | 99 if (child->GetType() == views::MenuItemView::SUBMENU) { |
100 bookmark_menu_delegate_->WillShowMenu(child); | 100 bookmark_menu_delegate_->WillShowMenu(child); |
101 LoadAllMenus(child); | 101 LoadAllMenus(child); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 while (model_->other_node()->child_count() > 1) | 223 while (model_->other_node()->child_count() > 1) |
224 model_->Remove(model_->other_node()->GetChild(1)); | 224 model_->Remove(model_->other_node()->GetChild(1)); |
225 | 225 |
226 NewDelegate(); | 226 NewDelegate(); |
227 bookmark_menu_delegate_->Init(&test_delegate, nullptr, node, 0, | 227 bookmark_menu_delegate_->Init(&test_delegate, nullptr, node, 0, |
228 BookmarkMenuDelegate::HIDE_PERMANENT_FOLDERS, | 228 BookmarkMenuDelegate::HIDE_PERMANENT_FOLDERS, |
229 BOOKMARK_LAUNCH_LOCATION_NONE); | 229 BOOKMARK_LAUNCH_LOCATION_NONE); |
230 // Any nodes on the bookmark bar should close on remove. | 230 // Any nodes on the bookmark bar should close on remove. |
231 EXPECT_TRUE(ShouldCloseOnRemove(model_->other_node()->GetChild(0))); | 231 EXPECT_TRUE(ShouldCloseOnRemove(model_->other_node()->GetChild(0))); |
232 } | 232 } |
OLD | NEW |