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 "chrome/browser/ui/gtk/bookmark_sub_menu_model_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
11 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
12 #include "chrome/browser/event_disposition.h" | 12 #include "chrome/browser/event_disposition.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 15 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (!node()) | 152 if (!node()) |
153 set_node(model()->bookmark_bar_node()); | 153 set_node(model()->bookmark_bar_node()); |
154 // PopulateMenu() won't clear the items we added above. | 154 // PopulateMenu() won't clear the items we added above. |
155 PopulateMenu(); | 155 PopulateMenu(); |
156 } | 156 } |
157 bookmark_end_ = GetItemCount(); | 157 bookmark_end_ = GetItemCount(); |
158 if (model()->other_node()->GetTotalNodeCount() > 1) { | 158 if (model()->other_node()->GetTotalNodeCount() > 1) { |
159 AddSeparator(); | 159 AddSeparator(); |
160 AddSubMenuForNode(model()->other_node()); | 160 AddSubMenuForNode(model()->other_node()); |
161 } | 161 } |
| 162 if (model()->mobile_node()->GetTotalNodeCount() > 1) { |
| 163 if (model()->other_node()->GetTotalNodeCount() == 1) |
| 164 AddSeparator(); |
| 165 AddSubMenuForNode(model()->mobile_node()); |
| 166 } |
162 } | 167 } |
163 | 168 |
164 void BookmarkSubMenuModel::ActivatedAt(int index) { | 169 void BookmarkSubMenuModel::ActivatedAt(int index) { |
165 // Because this is also overridden in BookmarkNodeMenuModel which doesn't know | 170 // Because this is also overridden in BookmarkNodeMenuModel which doesn't know |
166 // we might be prepending items, we have to adjust the index for it. | 171 // we might be prepending items, we have to adjust the index for it. |
167 if (index >= fixed_items_ && index < bookmark_end_) | 172 if (index >= fixed_items_ && index < bookmark_end_) |
168 BookmarkNodeMenuModel::ActivatedAt(index - fixed_items_); | 173 BookmarkNodeMenuModel::ActivatedAt(index - fixed_items_); |
169 else | 174 else |
170 SimpleMenuModel::ActivatedAt(index); | 175 SimpleMenuModel::ActivatedAt(index); |
171 } | 176 } |
(...skipping 14 matching lines...) Expand all Loading... |
186 | 191 |
187 bool BookmarkSubMenuModel::IsVisibleAt(int index) const { | 192 bool BookmarkSubMenuModel::IsVisibleAt(int index) const { |
188 // We don't want the delegate interfering with bookmark items. | 193 // We don't want the delegate interfering with bookmark items. |
189 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index); | 194 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index); |
190 } | 195 } |
191 | 196 |
192 // static | 197 // static |
193 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) { | 198 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) { |
194 return command_id == kBookmarkItemCommandId; | 199 return command_id == kBookmarkItemCommandId; |
195 } | 200 } |
OLD | NEW |