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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.cc

Issue 8775029: Makes gtk show the 'mobile' bookmark folder where appropriate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.h ('k') | chrome/browser/ui/gtk/browser_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698