| OLD | NEW |
| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 9 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 content::ContextMenuParams params; | 28 content::ContextMenuParams params; |
| 29 params.page_url = page_url; | 29 params.page_url = page_url; |
| 30 params.link_url = link_url; | 30 params.link_url = link_url; |
| 31 params.frame_url = frame_url; | 31 params.frame_url = frame_url; |
| 32 TestRenderViewContextMenu* menu = | 32 TestRenderViewContextMenu* menu = |
| 33 new TestRenderViewContextMenu(web_contents->GetMainFrame(), params); | 33 new TestRenderViewContextMenu(web_contents->GetMainFrame(), params); |
| 34 menu->Init(); | 34 menu->Init(); |
| 35 return menu; | 35 return menu; |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool TestRenderViewContextMenu::GetAcceleratorForCommandId( | |
| 39 int command_id, | |
| 40 ui::Accelerator* accelerator) const { | |
| 41 // None of our commands have accelerators, so always return false. | |
| 42 return false; | |
| 43 } | |
| 44 | |
| 45 bool TestRenderViewContextMenu::IsItemPresent(int command_id) { | 38 bool TestRenderViewContextMenu::IsItemPresent(int command_id) { |
| 46 return menu_model_.GetIndexOfCommandId(command_id) != -1; | 39 return menu_model_.GetIndexOfCommandId(command_id) != -1; |
| 47 } | 40 } |
| 48 | 41 |
| 49 bool TestRenderViewContextMenu::IsItemInRangePresent(int command_id_first, | 42 bool TestRenderViewContextMenu::IsItemInRangePresent(int command_id_first, |
| 50 int command_id_last) { | 43 int command_id_last) { |
| 51 DCHECK_LE(command_id_first, command_id_last); | 44 DCHECK_LE(command_id_first, command_id_last); |
| 52 for (int command_id = command_id_first; command_id <= command_id_last; | 45 for (int command_id = command_id_first; command_id <= command_id_last; |
| 53 ++command_id) { | 46 ++command_id) { |
| 54 if (IsItemPresent(command_id)) | 47 if (IsItemPresent(command_id)) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 85 const base::FilePath& path) { | 78 const base::FilePath& path) { |
| 86 size_t count = profile_link_paths_.size(); | 79 size_t count = profile_link_paths_.size(); |
| 87 for (size_t i = 0; i < count; ++i) | 80 for (size_t i = 0; i < count; ++i) |
| 88 if (profile_link_paths_[i] == path) | 81 if (profile_link_paths_[i] == path) |
| 89 return IDC_OPEN_LINK_IN_PROFILE_FIRST + static_cast<int>(i); | 82 return IDC_OPEN_LINK_IN_PROFILE_FIRST + static_cast<int>(i); |
| 90 return -1; | 83 return -1; |
| 91 } | 84 } |
| 92 | 85 |
| 93 void TestRenderViewContextMenu::Show() { | 86 void TestRenderViewContextMenu::Show() { |
| 94 } | 87 } |
| OLD | NEW |