OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/shell/browser/shell_web_contents_view_delegate.h" | 5 #include "content/shell/browser/shell_web_contents_view_delegate.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
9 #include "content/shell/browser/shell_devtools_frontend.h" | 9 #include "content/shell/browser/shell_devtools_frontend.h" |
10 #include "content/shell/common/shell_switches.h" | 10 #include "content/shell/common/shell_switches.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 : ui::SimpleMenuModel(this), | 25 : ui::SimpleMenuModel(this), |
26 web_contents_(web_contents), | 26 web_contents_(web_contents), |
27 params_(params) { | 27 params_(params) { |
28 AddItem(COMMAND_OPEN_DEVTOOLS, base::ASCIIToUTF16("Inspect Element")); | 28 AddItem(COMMAND_OPEN_DEVTOOLS, base::ASCIIToUTF16("Inspect Element")); |
29 } | 29 } |
30 ~ContextMenuModel() override {} | 30 ~ContextMenuModel() override {} |
31 | 31 |
32 // ui::SimpleMenuModel::Delegate: | 32 // ui::SimpleMenuModel::Delegate: |
33 bool IsCommandIdChecked(int command_id) const override { return false; } | 33 bool IsCommandIdChecked(int command_id) const override { return false; } |
34 bool IsCommandIdEnabled(int command_id) const override { return true; } | 34 bool IsCommandIdEnabled(int command_id) const override { return true; } |
35 bool GetAcceleratorForCommandId(int command_id, | |
36 ui::Accelerator* accelerator) const override { | |
37 return false; | |
38 } | |
39 void ExecuteCommand(int command_id, int event_flags) override { | 35 void ExecuteCommand(int command_id, int event_flags) override { |
40 switch (command_id) { | 36 switch (command_id) { |
41 case COMMAND_OPEN_DEVTOOLS: | 37 case COMMAND_OPEN_DEVTOOLS: |
42 ShellDevToolsFrontend* devtools_frontend = | 38 ShellDevToolsFrontend* devtools_frontend = |
43 ShellDevToolsFrontend::Show(web_contents_); | 39 ShellDevToolsFrontend::Show(web_contents_); |
44 devtools_frontend->Activate(); | 40 devtools_frontend->Activate(); |
45 devtools_frontend->Focus(); | 41 devtools_frontend->Focus(); |
46 devtools_frontend->InspectElementAt(params_.x, params_.y); | 42 devtools_frontend->InspectElementAt(params_.x, params_.y); |
47 break; | 43 break; |
48 }; | 44 }; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 web_contents_->GetTopLevelNativeWindow()); | 93 web_contents_->GetTopLevelNativeWindow()); |
98 if (context_menu_runner_->RunMenuAt( | 94 if (context_menu_runner_->RunMenuAt( |
99 widget, nullptr, gfx::Rect(screen_point, gfx::Size()), | 95 widget, nullptr, gfx::Rect(screen_point, gfx::Size()), |
100 views::MENU_ANCHOR_TOPRIGHT, | 96 views::MENU_ANCHOR_TOPRIGHT, |
101 ui::MENU_SOURCE_NONE) == views::MenuRunner::MENU_DELETED) { | 97 ui::MENU_SOURCE_NONE) == views::MenuRunner::MENU_DELETED) { |
102 return; | 98 return; |
103 } | 99 } |
104 } | 100 } |
105 | 101 |
106 } // namespace content | 102 } // namespace content |
OLD | NEW |