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

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

Issue 10837317: Setting the touch wrench menu as default menu for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another merge! Created 8 years, 4 months 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) 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/gtk/bookmarks/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"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 set_model(BookmarkModelFactory::GetForProfile(browser_->profile())); 161 set_model(BookmarkModelFactory::GetForProfile(browser_->profile()));
162 if (!model()) 162 if (!model())
163 return; 163 return;
164 model()->AddObserver(this); 164 model()->AddObserver(this);
165 } 165 }
166 // We can't do anything further if the model isn't loaded yet. 166 // We can't do anything further if the model isn't loaded yet.
167 if (!model()->IsLoaded()) 167 if (!model()->IsLoaded())
168 return; 168 return;
169 // The node count includes the node itself, so 1 means empty. 169 // The node count includes the node itself, so 1 means empty.
170 if (model()->bookmark_bar_node()->GetTotalNodeCount() > 1) { 170 if (model()->bookmark_bar_node()->GetTotalNodeCount() > 1) {
171 AddSeparator(); 171 AddSeparator(ui::NORMAL_SEPARATOR);
172 fixed_items_ = GetItemCount(); 172 fixed_items_ = GetItemCount();
173 if (!node()) 173 if (!node())
174 set_node(model()->bookmark_bar_node()); 174 set_node(model()->bookmark_bar_node());
175 // PopulateMenu() won't clear the items we added above. 175 // PopulateMenu() won't clear the items we added above.
176 PopulateMenu(); 176 PopulateMenu();
177 } 177 }
178 bookmark_end_ = GetItemCount(); 178 bookmark_end_ = GetItemCount();
179 // We want only one separator after the top-level bookmarks and before the 179 // We want only one separator after the top-level bookmarks and before the
180 // other node and/or mobile node. Keep track of whether we've added it yet. 180 // other node and/or mobile node. Keep track of whether we've added it yet.
181 bool added_separator = false; 181 bool added_separator = false;
182 if (model()->other_node()->GetTotalNodeCount() > 1) { 182 if (model()->other_node()->GetTotalNodeCount() > 1) {
183 AddSeparator(); 183 AddSeparator(ui::NORMAL_SEPARATOR);
184 added_separator = true; 184 added_separator = true;
185 AddSubMenuForNode(model()->other_node()); 185 AddSubMenuForNode(model()->other_node());
186 } 186 }
187 if (model()->mobile_node()->GetTotalNodeCount() > 1) { 187 if (model()->mobile_node()->GetTotalNodeCount() > 1) {
188 if (!added_separator) 188 if (!added_separator)
189 AddSeparator(); 189 AddSeparator(ui::NORMAL_SEPARATOR);
190 AddSubMenuForNode(model()->mobile_node()); 190 AddSubMenuForNode(model()->mobile_node());
191 } 191 }
192 } 192 }
193 193
194 void BookmarkSubMenuModel::MenuClosed() { 194 void BookmarkSubMenuModel::MenuClosed() {
195 menu_showing_ = false; 195 menu_showing_ = false;
196 BookmarkNodeMenuModel::MenuClosed(); 196 BookmarkNodeMenuModel::MenuClosed();
197 } 197 }
198 198
199 void BookmarkSubMenuModel::ActivatedAt(int index) { 199 void BookmarkSubMenuModel::ActivatedAt(int index) {
(...skipping 21 matching lines...) Expand all
221 221
222 bool BookmarkSubMenuModel::IsVisibleAt(int index) const { 222 bool BookmarkSubMenuModel::IsVisibleAt(int index) const {
223 // We don't want the delegate interfering with bookmark items. 223 // We don't want the delegate interfering with bookmark items.
224 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index); 224 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index);
225 } 225 }
226 226
227 // static 227 // static
228 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) { 228 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) {
229 return command_id == kBookmarkItemCommandId; 229 return command_id == kBookmarkItemCommandId;
230 } 230 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.mm ('k') | chrome/browser/ui/gtk/browser_titlebar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698