OLD | NEW |
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 void DevToolsEventForwarder::SetWhitelistedShortcuts( | 248 void DevToolsEventForwarder::SetWhitelistedShortcuts( |
249 const std::string& message) { | 249 const std::string& message) { |
250 std::unique_ptr<base::Value> parsed_message = base::JSONReader::Read(message); | 250 std::unique_ptr<base::Value> parsed_message = base::JSONReader::Read(message); |
251 base::ListValue* shortcut_list; | 251 base::ListValue* shortcut_list; |
252 if (!parsed_message || !parsed_message->GetAsList(&shortcut_list)) | 252 if (!parsed_message || !parsed_message->GetAsList(&shortcut_list)) |
253 return; | 253 return; |
254 base::ListValue::iterator it = shortcut_list->begin(); | 254 base::ListValue::iterator it = shortcut_list->begin(); |
255 for (; it != shortcut_list->end(); ++it) { | 255 for (; it != shortcut_list->end(); ++it) { |
256 base::DictionaryValue* dictionary; | 256 base::DictionaryValue* dictionary; |
257 if (!(*it)->GetAsDictionary(&dictionary)) | 257 if (!it->GetAsDictionary(&dictionary)) |
258 continue; | 258 continue; |
259 int key_code = 0; | 259 int key_code = 0; |
260 dictionary->GetInteger("keyCode", &key_code); | 260 dictionary->GetInteger("keyCode", &key_code); |
261 if (key_code == 0) | 261 if (key_code == 0) |
262 continue; | 262 continue; |
263 int modifiers = 0; | 263 int modifiers = 0; |
264 dictionary->GetInteger("modifiers", &modifiers); | 264 dictionary->GetInteger("modifiers", &modifiers); |
265 if (!KeyWhitelistingAllowed(key_code, modifiers)) { | 265 if (!KeyWhitelistingAllowed(key_code, modifiers)) { |
266 LOG(WARNING) << "Key whitelisting forbidden: " | 266 LOG(WARNING) << "Key whitelisting forbidden: " |
267 << "(" << key_code << "," << modifiers << ")"; | 267 << "(" << key_code << "," << modifiers << ")"; |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { | 1409 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { |
1410 // Only route reload via front-end if the agent is attached. | 1410 // Only route reload via front-end if the agent is attached. |
1411 WebContents* wc = GetInspectedWebContents(); | 1411 WebContents* wc = GetInspectedWebContents(); |
1412 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1412 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
1413 return false; | 1413 return false; |
1414 base::Value bypass_cache_value(bypass_cache); | 1414 base::Value bypass_cache_value(bypass_cache); |
1415 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1415 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
1416 &bypass_cache_value, nullptr, nullptr); | 1416 &bypass_cache_value, nullptr, nullptr); |
1417 return true; | 1417 return true; |
1418 } | 1418 } |
OLD | NEW |