| 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/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/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/bookmarks/bookmark_model_factory.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_stats.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 16 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
| 16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 17 #include "chrome/browser/ui/gtk/menu_gtk.h" | 18 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 19 #include "grit/theme_resources.h" | 20 #include "grit/theme_resources.h" |
| 20 #include "ui/base/accelerators/menu_label_accelerator_util_linux.h" | 21 #include "ui/base/accelerators/menu_label_accelerator_util_linux.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 const gfx::Image& folder_icon = rb.GetImageNamed(IDR_BOOKMARK_BAR_FOLDER); | 113 const gfx::Image& folder_icon = rb.GetImageNamed(IDR_BOOKMARK_BAR_FOLDER); |
| 113 SetIcon(GetItemCount() - 1, folder_icon); | 114 SetIcon(GetItemCount() - 1, folder_icon); |
| 114 submenus_.push_back(submenu); | 115 submenus_.push_back(submenu); |
| 115 } | 116 } |
| 116 | 117 |
| 117 void BookmarkNodeMenuModel::NavigateToMenuItem( | 118 void BookmarkNodeMenuModel::NavigateToMenuItem( |
| 118 int index, | 119 int index, |
| 119 WindowOpenDisposition disposition) { | 120 WindowOpenDisposition disposition) { |
| 120 const BookmarkNode* node = node_->GetChild(index); | 121 const BookmarkNode* node = node_->GetChild(index); |
| 121 DCHECK(node); | 122 DCHECK(node); |
| 123 RecordBookmarkLaunch(node, BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); |
| 122 page_navigator_->OpenURL(OpenURLParams( | 124 page_navigator_->OpenURL(OpenURLParams( |
| 123 node->url(), content::Referrer(), disposition, | 125 node->url(), content::Referrer(), disposition, |
| 124 content::PAGE_TRANSITION_AUTO_BOOKMARK, | 126 content::PAGE_TRANSITION_AUTO_BOOKMARK, |
| 125 false)); // is_renderer_initiated | 127 false)); // is_renderer_initiated |
| 126 } | 128 } |
| 127 | 129 |
| 128 BookmarkSubMenuModel::BookmarkSubMenuModel( | 130 BookmarkSubMenuModel::BookmarkSubMenuModel( |
| 129 ui::SimpleMenuModel::Delegate* delegate, | 131 ui::SimpleMenuModel::Delegate* delegate, |
| 130 Browser* browser) | 132 Browser* browser) |
| 131 : BookmarkNodeMenuModel(delegate, NULL, NULL, browser, browser->profile()), | 133 : BookmarkNodeMenuModel(delegate, NULL, NULL, browser, browser->profile()), |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 232 |
| 231 bool BookmarkSubMenuModel::IsVisibleAt(int index) const { | 233 bool BookmarkSubMenuModel::IsVisibleAt(int index) const { |
| 232 // We don't want the delegate interfering with bookmark items. | 234 // We don't want the delegate interfering with bookmark items. |
| 233 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index); | 235 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index); |
| 234 } | 236 } |
| 235 | 237 |
| 236 // static | 238 // static |
| 237 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) { | 239 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) { |
| 238 return command_id == kBookmarkItemCommandId; | 240 return command_id == kBookmarkItemCommandId; |
| 239 } | 241 } |
| OLD | NEW |