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

Side by Side Diff: chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc

Issue 1191453002: Implement "open link as user" context menu entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer_context_menu/render_view_context_menu_test_uti l.h" 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti l.h"
6 #include "content/public/browser/web_contents.h" 6 #include "content/public/browser/web_contents.h"
7 #include "ui/base/models/menu_model.h" 7 #include "ui/base/models/menu_model.h"
8 8
9 using ui::MenuModel; 9 using ui::MenuModel;
10 10
(...skipping 24 matching lines...) Expand all
35 int command_id, 35 int command_id,
36 ui::Accelerator* accelerator) { 36 ui::Accelerator* accelerator) {
37 // None of our commands have accelerators, so always return false. 37 // None of our commands have accelerators, so always return false.
38 return false; 38 return false;
39 } 39 }
40 40
41 bool TestRenderViewContextMenu::IsItemPresent(int command_id) { 41 bool TestRenderViewContextMenu::IsItemPresent(int command_id) {
42 return menu_model_.GetIndexOfCommandId(command_id) != -1; 42 return menu_model_.GetIndexOfCommandId(command_id) != -1;
43 } 43 }
44 44
45 bool TestRenderViewContextMenu::IsItemInRangePresent(int command_id_first,
46 int command_id_last) {
47 DCHECK_LE(command_id_first, command_id_last);
48 for (int command_id = command_id_first; command_id <= command_id_last;
49 ++command_id) {
50 if (IsItemPresent(command_id))
51 return true;
52 }
53 return false;
54 }
55
45 bool TestRenderViewContextMenu::GetMenuModelAndItemIndex( 56 bool TestRenderViewContextMenu::GetMenuModelAndItemIndex(
46 int command_id, 57 int command_id,
47 MenuModel** found_model, 58 MenuModel** found_model,
48 int* found_index) { 59 int* found_index) {
49 std::vector<MenuModel*> models_to_search; 60 std::vector<MenuModel*> models_to_search;
50 models_to_search.push_back(&menu_model_); 61 models_to_search.push_back(&menu_model_);
51 62
52 while (!models_to_search.empty()) { 63 while (!models_to_search.empty()) {
53 MenuModel* model = models_to_search.back(); 64 MenuModel* model = models_to_search.back();
54 models_to_search.pop_back(); 65 models_to_search.pop_back();
55 for (int i = 0; i < model->GetItemCount(); i++) { 66 for (int i = 0; i < model->GetItemCount(); i++) {
56 if (model->GetCommandIdAt(i) == command_id) { 67 if (model->GetCommandIdAt(i) == command_id) {
57 *found_model = model; 68 *found_model = model;
58 *found_index = i; 69 *found_index = i;
59 return true; 70 return true;
60 } else if (model->GetTypeAt(i) == MenuModel::TYPE_SUBMENU) { 71 } else if (model->GetTypeAt(i) == MenuModel::TYPE_SUBMENU) {
61 models_to_search.push_back(model->GetSubmenuModelAt(i)); 72 models_to_search.push_back(model->GetSubmenuModelAt(i));
62 } 73 }
63 } 74 }
64 } 75 }
65 76
66 return false; 77 return false;
67 } 78 }
68 79
69 void TestRenderViewContextMenu::Show() { 80 void TestRenderViewContextMenu::Show() {
70 } 81 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698