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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 return false; | 94 return false; |
95 } | 95 } |
96 | 96 |
97 void SetPreferencesFromJson(Profile* profile, const std::string& json) { | 97 void SetPreferencesFromJson(Profile* profile, const std::string& json) { |
98 base::DictionaryValue* dict = nullptr; | 98 base::DictionaryValue* dict = nullptr; |
99 std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json); | 99 std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json); |
100 if (!parsed || !parsed->GetAsDictionary(&dict)) | 100 if (!parsed || !parsed->GetAsDictionary(&dict)) |
101 return; | 101 return; |
102 DictionaryPrefUpdate update(profile->GetPrefs(), prefs::kDevToolsPreferences); | 102 DictionaryPrefUpdate update(profile->GetPrefs(), prefs::kDevToolsPreferences); |
103 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 103 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
104 if (!it.value().IsType(base::Value::TYPE_STRING)) | 104 if (!it.value().IsType(base::Value::Type::STRING)) |
105 continue; | 105 continue; |
106 update.Get()->SetWithoutPathExpansion( | 106 update.Get()->SetWithoutPathExpansion( |
107 it.key(), it.value().CreateDeepCopy()); | 107 it.key(), it.value().CreateDeepCopy()); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 // DevToolsToolboxDelegate ---------------------------------------------------- | 111 // DevToolsToolboxDelegate ---------------------------------------------------- |
112 | 112 |
113 class DevToolsToolboxDelegate | 113 class DevToolsToolboxDelegate |
114 : public content::WebContentsObserver, | 114 : public content::WebContentsObserver, |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { | 1382 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { |
1383 // Only route reload via front-end if the agent is attached. | 1383 // Only route reload via front-end if the agent is attached. |
1384 WebContents* wc = GetInspectedWebContents(); | 1384 WebContents* wc = GetInspectedWebContents(); |
1385 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1385 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
1386 return false; | 1386 return false; |
1387 base::FundamentalValue bypass_cache_value(bypass_cache); | 1387 base::FundamentalValue bypass_cache_value(bypass_cache); |
1388 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1388 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
1389 &bypass_cache_value, nullptr, nullptr); | 1389 &bypass_cache_value, nullptr, nullptr); |
1390 return true; | 1390 return true; |
1391 } | 1391 } |
OLD | NEW |