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

Unified Diff: chrome/browser/back_forward_menu_model_views.cc

Issue 501168: Make back forward menu model a MenuModel.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/back_forward_menu_model_views.cc
===================================================================
--- chrome/browser/back_forward_menu_model_views.cc (revision 35347)
+++ chrome/browser/back_forward_menu_model_views.cc (working copy)
@@ -1,99 +0,0 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/back_forward_menu_model_views.h"
-
-#include "app/menus/menu_model.h"
-#include "chrome/app/chrome_dll_resource.h"
-#include "chrome/browser/browser.h"
-#include "chrome/browser/metrics/user_metrics.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "views/controls/menu/menu_2.h"
-#include "views/widget/widget.h"
-
-////////////////////////////////////////////////////////////////////////////////
-// BackForwardMenuModelViews, public:
-
-BackForwardMenuModelViews::BackForwardMenuModelViews(Browser* browser,
- ModelType model_type,
- views::Widget* frame)
- : BackForwardMenuModel(browser, model_type),
- frame_(frame) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// BackForwardMenuModelViews, menus::MenuModel implementation:
-
-bool BackForwardMenuModelViews::HasIcons() const {
- return true;
-}
-
-int BackForwardMenuModelViews::GetItemCount() const {
- return GetTotalItemCount();
-}
-
-menus::MenuModel::ItemType BackForwardMenuModelViews::GetTypeAt(
- int index) const {
- if (IsSeparator(GetCommandIdAt(index)))
- return menus::MenuModel::TYPE_SEPARATOR;
- return menus::MenuModel::TYPE_COMMAND;
-}
-
-int BackForwardMenuModelViews::GetCommandIdAt(int index) const {
- return index + 1;
-}
-
-string16 BackForwardMenuModelViews::GetLabelAt(int index) const {
- return GetItemLabel(GetCommandIdAt(index));
-}
-
-bool BackForwardMenuModelViews::IsLabelDynamicAt(int index) const {
- return false;
-}
-
-bool BackForwardMenuModelViews::GetAcceleratorAt(
- int index,
- menus::Accelerator* accelerator) const {
- // Look up the history accelerator.
- if (GetCommandIdAt(index) == GetTotalItemCount())
- return frame_->GetAccelerator(IDC_SHOW_HISTORY, accelerator);
- return false;
-}
-
-bool BackForwardMenuModelViews::IsItemCheckedAt(int index) const {
- return false;
-}
-
-int BackForwardMenuModelViews::GetGroupIdAt(int index) const {
- return -1;
-}
-
-bool BackForwardMenuModelViews::GetIconAt(int index, SkBitmap* icon) const {
- if (ItemHasIcon(GetCommandIdAt(index))) {
- *icon = GetItemIcon(GetCommandIdAt(index));
- return true;
- }
- return false;
-}
-
-bool BackForwardMenuModelViews::IsEnabledAt(int index) const {
- return true;
-}
-
-menus::MenuModel* BackForwardMenuModelViews::GetSubmenuModelAt(
- int index) const {
- return NULL;
-}
-
-void BackForwardMenuModelViews::HighlightChangedTo(int index) {
-}
-
-void BackForwardMenuModelViews::ActivatedAt(int index) {
- ExecuteCommandById(GetCommandIdAt(index));
-}
-
-void BackForwardMenuModelViews::MenuWillShow() {
- UserMetrics::RecordComputedAction(BuildActionName("Popup", -1),
- browser_->profile());
-}

Powered by Google App Engine
This is Rietveld 408576698