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