| 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/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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 void BookmarkNodeMenuModel::MenuClosed() { | 56 void BookmarkNodeMenuModel::MenuClosed() { |
| 57 Clear(); | 57 Clear(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void BookmarkNodeMenuModel::ActivatedAt(int index) { | 60 void BookmarkNodeMenuModel::ActivatedAt(int index) { |
| 61 NavigateToMenuItem(index, CURRENT_TAB); | 61 NavigateToMenuItem(index, CURRENT_TAB); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void BookmarkNodeMenuModel::ActivatedAt(int index, int event_flags) { | 64 void BookmarkNodeMenuModel::ActivatedAt(int index, int event_flags) { |
| 65 NavigateToMenuItem(index, browser::DispositionFromEventFlags(event_flags)); | 65 NavigateToMenuItem(index, chrome::DispositionFromEventFlags(event_flags)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void BookmarkNodeMenuModel::PopulateMenu() { | 68 void BookmarkNodeMenuModel::PopulateMenu() { |
| 69 DCHECK(submenus_.empty()); | 69 DCHECK(submenus_.empty()); |
| 70 for (int i = 0; i < node_->child_count(); ++i) { | 70 for (int i = 0; i < node_->child_count(); ++i) { |
| 71 const BookmarkNode* child = node_->GetChild(i); | 71 const BookmarkNode* child = node_->GetChild(i); |
| 72 if (child->is_folder()) { | 72 if (child->is_folder()) { |
| 73 AddSubMenuForNode(child); | 73 AddSubMenuForNode(child); |
| 74 } else { | 74 } else { |
| 75 // Ironically the label will end up getting converted back to UTF8 later. | 75 // Ironically the label will end up getting converted back to UTF8 later. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 220 |
| 221 bool BookmarkSubMenuModel::IsVisibleAt(int index) const { | 221 bool BookmarkSubMenuModel::IsVisibleAt(int index) const { |
| 222 // We don't want the delegate interfering with bookmark items. | 222 // We don't want the delegate interfering with bookmark items. |
| 223 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index); | 223 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index); |
| 224 } | 224 } |
| 225 | 225 |
| 226 // static | 226 // static |
| 227 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) { | 227 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) { |
| 228 return command_id == kBookmarkItemCommandId; | 228 return command_id == kBookmarkItemCommandId; |
| 229 } | 229 } |
| OLD | NEW |