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

Side by Side Diff: chrome/browser/devtools/devtools_window.cc

Issue 2033403005: Eradicate keyIndentifier from devtools/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call KeyCodeToKeyIdentifier for unhandle key events Created 4 years, 6 months 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
« no previous file with comments | « chrome/browser/devtools/BUILD.gn ('k') | chrome/chrome_debugger.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/devtools/devtools_window.h" 5 #include "chrome/browser/devtools/devtools_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "content/public/browser/render_process_host.h" 44 #include "content/public/browser/render_process_host.h"
45 #include "content/public/browser/render_view_host.h" 45 #include "content/public/browser/render_view_host.h"
46 #include "content/public/browser/render_widget_host_view.h" 46 #include "content/public/browser/render_widget_host_view.h"
47 #include "content/public/browser/user_metrics.h" 47 #include "content/public/browser/user_metrics.h"
48 #include "content/public/browser/web_contents.h" 48 #include "content/public/browser/web_contents.h"
49 #include "content/public/common/content_client.h" 49 #include "content/public/common/content_client.h"
50 #include "content/public/common/url_constants.h" 50 #include "content/public/common/url_constants.h"
51 #include "net/base/escape.h" 51 #include "net/base/escape.h"
52 #include "third_party/WebKit/public/web/WebInputEvent.h" 52 #include "third_party/WebKit/public/web/WebInputEvent.h"
53 #include "ui/base/page_transition_types.h" 53 #include "ui/base/page_transition_types.h"
54 #include "ui/events/keycodes/dom/keycode_converter.h"
54 #include "ui/events/keycodes/keyboard_code_conversion.h" 55 #include "ui/events/keycodes/keyboard_code_conversion.h"
55 #include "ui/events/keycodes/keyboard_codes.h" 56 #include "ui/events/keycodes/keyboard_codes.h"
56 57
57 using base::DictionaryValue; 58 using base::DictionaryValue;
58 using blink::WebInputEvent; 59 using blink::WebInputEvent;
59 using content::BrowserThread; 60 using content::BrowserThread;
60 using content::DevToolsAgentHost; 61 using content::DevToolsAgentHost;
61 using content::WebContents; 62 using content::WebContents;
62 63
63 namespace { 64 namespace {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 int modifiers = event.modifiers & (WebInputEvent::ShiftKey | 266 int modifiers = event.modifiers & (WebInputEvent::ShiftKey |
266 WebInputEvent::ControlKey | 267 WebInputEvent::ControlKey |
267 WebInputEvent::AltKey | 268 WebInputEvent::AltKey |
268 WebInputEvent::MetaKey); 269 WebInputEvent::MetaKey);
269 int key = CombineKeyCodeAndModifiers(key_code, modifiers); 270 int key = CombineKeyCodeAndModifiers(key_code, modifiers);
270 if (whitelisted_keys_.find(key) == whitelisted_keys_.end()) 271 if (whitelisted_keys_.find(key) == whitelisted_keys_.end())
271 return false; 272 return false;
272 273
273 base::DictionaryValue event_data; 274 base::DictionaryValue event_data;
274 event_data.SetString("type", event_type); 275 event_data.SetString("type", event_type);
275 event_data.SetString("keyIdentifier", event.keyIdentifier); 276 event_data.SetString("key", ui::KeycodeConverter::DomKeyToKeyString(
277 static_cast<ui::DomKey>(event.domKey)));
278 event_data.SetString("code", ui::KeycodeConverter::DomCodeToCodeString(
279 static_cast<ui::DomCode>(event.domCode)));
276 event_data.SetInteger("keyCode", key_code); 280 event_data.SetInteger("keyCode", key_code);
277 event_data.SetInteger("modifiers", modifiers); 281 event_data.SetInteger("modifiers", modifiers);
278 devtools_window_->bindings_->CallClientFunction( 282 devtools_window_->bindings_->CallClientFunction(
279 "DevToolsAPI.keyEventUnhandled", &event_data, NULL, NULL); 283 "DevToolsAPI.keyEventUnhandled", &event_data, NULL, NULL);
280 return true; 284 return true;
281 } 285 }
282 286
283 int DevToolsEventForwarder::CombineKeyCodeAndModifiers(int key_code, 287 int DevToolsEventForwarder::CombineKeyCodeAndModifiers(int key_code,
284 int modifiers) { 288 int modifiers) {
285 return key_code | (modifiers << 16); 289 return key_code | (modifiers << 16);
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { 1303 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) {
1300 // Only route reload via front-end if the agent is attached. 1304 // Only route reload via front-end if the agent is attached.
1301 WebContents* wc = GetInspectedWebContents(); 1305 WebContents* wc = GetInspectedWebContents();
1302 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) 1306 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING)
1303 return false; 1307 return false;
1304 base::FundamentalValue bypass_cache_value(bypass_cache); 1308 base::FundamentalValue bypass_cache_value(bypass_cache);
1305 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", 1309 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage",
1306 &bypass_cache_value, nullptr, nullptr); 1310 &bypass_cache_value, nullptr, nullptr);
1307 return true; 1311 return true;
1308 } 1312 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/BUILD.gn ('k') | chrome/chrome_debugger.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698