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/ui/webui/inspect_ui.h" | 5 #include "chrome/browser/ui/webui/inspect_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 static const char kAppTargetType[] = "app"; | 67 static const char kAppTargetType[] = "app"; |
68 static const char kExtensionTargetType[] = "extension"; | 68 static const char kExtensionTargetType[] = "extension"; |
69 static const char kPageTargetType[] = "page"; | 69 static const char kPageTargetType[] = "page"; |
70 static const char kWorkerTargetType[] = "worker"; | 70 static const char kWorkerTargetType[] = "worker"; |
71 static const char kAdbTargetType[] = "adb_page"; | 71 static const char kAdbTargetType[] = "adb_page"; |
72 | 72 |
73 static const char kInitUICommand[] = "init-ui"; | 73 static const char kInitUICommand[] = "init-ui"; |
74 static const char kInspectCommand[] = "inspect"; | 74 static const char kInspectCommand[] = "inspect"; |
75 static const char kTerminateCommand[] = "terminate"; | 75 static const char kTerminateCommand[] = "terminate"; |
| 76 static const char kReloadCommand[] = "reload"; |
| 77 static const char kOpenCommand[] = "open"; |
| 78 |
76 static const char kPortForwardingEnabledCommand[] = | 79 static const char kPortForwardingEnabledCommand[] = |
77 "set-port-forwarding-enabled"; | 80 "set-port-forwarding-enabled"; |
78 static const char kPortForwardingConfigCommand[] = "set-port-forwarding-config"; | 81 static const char kPortForwardingConfigCommand[] = "set-port-forwarding-config"; |
79 | 82 |
80 static const char kTargetTypeField[] = "type"; | 83 static const char kTargetTypeField[] = "type"; |
81 static const char kAttachedField[] = "attached"; | 84 static const char kAttachedField[] = "attached"; |
82 static const char kProcessIdField[] = "processId"; | 85 static const char kProcessIdField[] = "processId"; |
83 static const char kRouteIdField[] = "routeId"; | 86 static const char kRouteIdField[] = "routeId"; |
84 static const char kUrlField[] = "url"; | 87 static const char kUrlField[] = "url"; |
85 static const char kNameField[] = "name"; | 88 static const char kNameField[] = "name"; |
86 static const char kFaviconUrlField[] = "faviconUrl"; | 89 static const char kFaviconUrlField[] = "faviconUrl"; |
87 static const char kPidField[] = "pid"; | 90 static const char kPidField[] = "pid"; |
88 static const char kAdbSerialField[] = "adbSerial"; | 91 static const char kAdbSerialField[] = "adbSerial"; |
89 static const char kAdbModelField[] = "adbModel"; | 92 static const char kAdbModelField[] = "adbModel"; |
90 static const char kAdbBrowserNameField[] = "adbBrowserName"; | 93 static const char kAdbBrowserNameField[] = "adbBrowserName"; |
91 static const char kAdbPageIdField[] = "adbPageId"; | 94 static const char kAdbGlobalIdField[] = "adbGlobalId"; |
92 static const char kAdbBrowsersField[] = "browsers"; | 95 static const char kAdbBrowsersField[] = "browsers"; |
93 static const char kAdbPagesField[] = "pages"; | 96 static const char kAdbPagesField[] = "pages"; |
94 | 97 |
95 DictionaryValue* BuildTargetDescriptor( | 98 DictionaryValue* BuildTargetDescriptor( |
96 const std::string& target_type, | 99 const std::string& target_type, |
97 bool attached, | 100 bool attached, |
98 const GURL& url, | 101 const GURL& url, |
99 const std::string& name, | 102 const std::string& name, |
100 const GURL& favicon_url, | 103 const GURL& favicon_url, |
101 int process_id, | 104 int process_id, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 : inspect_ui_(inspect_ui) {} | 173 : inspect_ui_(inspect_ui) {} |
171 virtual ~InspectMessageHandler() {} | 174 virtual ~InspectMessageHandler() {} |
172 | 175 |
173 private: | 176 private: |
174 // WebUIMessageHandler implementation. | 177 // WebUIMessageHandler implementation. |
175 virtual void RegisterMessages() OVERRIDE; | 178 virtual void RegisterMessages() OVERRIDE; |
176 | 179 |
177 void HandleInitUICommand(const ListValue* args); | 180 void HandleInitUICommand(const ListValue* args); |
178 void HandleInspectCommand(const ListValue* args); | 181 void HandleInspectCommand(const ListValue* args); |
179 void HandleTerminateCommand(const ListValue* args); | 182 void HandleTerminateCommand(const ListValue* args); |
| 183 void HandleReloadCommand(const ListValue* args); |
| 184 void HandleOpenCommand(const ListValue* args); |
180 void HandlePortForwardingEnabledCommand(const ListValue* args); | 185 void HandlePortForwardingEnabledCommand(const ListValue* args); |
181 void HandlePortForwardingConfigCommand(const ListValue* args); | 186 void HandlePortForwardingConfigCommand(const ListValue* args); |
182 | 187 |
183 bool GetProcessAndRouteId(const ListValue* args, | 188 static bool GetProcessAndRouteId(const ListValue* args, |
184 int* process_id, | 189 int* process_id, |
185 int* route_id); | 190 int* route_id); |
| 191 |
| 192 static bool GetRemotePageId(const ListValue* args, std::string* page_id); |
186 | 193 |
187 InspectUI* inspect_ui_; | 194 InspectUI* inspect_ui_; |
188 | 195 |
189 DISALLOW_COPY_AND_ASSIGN(InspectMessageHandler); | 196 DISALLOW_COPY_AND_ASSIGN(InspectMessageHandler); |
190 }; | 197 }; |
191 | 198 |
192 void InspectMessageHandler::RegisterMessages() { | 199 void InspectMessageHandler::RegisterMessages() { |
193 web_ui()->RegisterMessageCallback(kInitUICommand, | 200 web_ui()->RegisterMessageCallback(kInitUICommand, |
194 base::Bind(&InspectMessageHandler::HandleInitUICommand, | 201 base::Bind(&InspectMessageHandler::HandleInitUICommand, |
195 base::Unretained(this))); | 202 base::Unretained(this))); |
196 web_ui()->RegisterMessageCallback(kInspectCommand, | 203 web_ui()->RegisterMessageCallback(kInspectCommand, |
197 base::Bind(&InspectMessageHandler::HandleInspectCommand, | 204 base::Bind(&InspectMessageHandler::HandleInspectCommand, |
198 base::Unretained(this))); | 205 base::Unretained(this))); |
199 web_ui()->RegisterMessageCallback(kTerminateCommand, | 206 web_ui()->RegisterMessageCallback(kTerminateCommand, |
200 base::Bind(&InspectMessageHandler::HandleTerminateCommand, | 207 base::Bind(&InspectMessageHandler::HandleTerminateCommand, |
201 base::Unretained(this))); | 208 base::Unretained(this))); |
202 web_ui()->RegisterMessageCallback(kPortForwardingEnabledCommand, | 209 web_ui()->RegisterMessageCallback(kPortForwardingEnabledCommand, |
203 base::Bind(&InspectMessageHandler::HandlePortForwardingEnabledCommand, | 210 base::Bind(&InspectMessageHandler::HandlePortForwardingEnabledCommand, |
204 base::Unretained(this))); | 211 base::Unretained(this))); |
205 web_ui()->RegisterMessageCallback(kPortForwardingConfigCommand, | 212 web_ui()->RegisterMessageCallback(kPortForwardingConfigCommand, |
206 base::Bind(&InspectMessageHandler::HandlePortForwardingConfigCommand, | 213 base::Bind(&InspectMessageHandler::HandlePortForwardingConfigCommand, |
207 base::Unretained(this))); | 214 base::Unretained(this))); |
| 215 web_ui()->RegisterMessageCallback(kReloadCommand, |
| 216 base::Bind(&InspectMessageHandler::HandleReloadCommand, |
| 217 base::Unretained(this))); |
| 218 web_ui()->RegisterMessageCallback(kOpenCommand, |
| 219 base::Bind(&InspectMessageHandler::HandleOpenCommand, |
| 220 base::Unretained(this))); |
208 } | 221 } |
209 | 222 |
210 void InspectMessageHandler::HandleInitUICommand(const ListValue*) { | 223 void InspectMessageHandler::HandleInitUICommand(const ListValue*) { |
211 inspect_ui_->InitUI(); | 224 inspect_ui_->InitUI(); |
212 } | 225 } |
213 | 226 |
214 void InspectMessageHandler::HandleInspectCommand(const ListValue* args) { | 227 void InspectMessageHandler::HandleInspectCommand(const ListValue* args) { |
215 Profile* profile = Profile::FromWebUI(web_ui()); | 228 Profile* profile = Profile::FromWebUI(web_ui()); |
216 if (!profile) | 229 if (!profile) |
217 return; | 230 return; |
218 | 231 |
| 232 std::string page_id; |
| 233 if (GetRemotePageId(args, &page_id)) { |
| 234 inspect_ui_->InspectRemotePage(page_id); |
| 235 return; |
| 236 } |
| 237 |
219 int process_id; | 238 int process_id; |
220 int route_id; | 239 int route_id; |
221 if (!GetProcessAndRouteId(args, &process_id, &route_id) || process_id == 0 | 240 if (!GetProcessAndRouteId(args, &process_id, &route_id) || process_id == 0 |
222 || route_id == 0) { | 241 || route_id == 0) { |
223 // Check for ADB page id | |
224 const DictionaryValue* data; | |
225 std::string page_id; | |
226 if (args->GetSize() == 1 && args->GetDictionary(0, &data) && | |
227 data->GetString(kAdbPageIdField, &page_id)) { | |
228 inspect_ui_->InspectRemotePage(page_id); | |
229 } | |
230 return; | 242 return; |
231 } | 243 } |
232 | 244 |
233 RenderViewHost* rvh = RenderViewHost::FromID(process_id, route_id); | 245 RenderViewHost* rvh = RenderViewHost::FromID(process_id, route_id); |
234 if (rvh) { | 246 if (rvh) { |
235 DevToolsWindow::OpenDevToolsWindow(rvh); | 247 DevToolsWindow::OpenDevToolsWindow(rvh); |
236 return; | 248 return; |
237 } | 249 } |
238 | 250 |
239 scoped_refptr<DevToolsAgentHost> agent_host( | 251 scoped_refptr<DevToolsAgentHost> agent_host( |
240 DevToolsAgentHost::GetForWorker(process_id, route_id)); | 252 DevToolsAgentHost::GetForWorker(process_id, route_id)); |
241 if (!agent_host.get()) | 253 if (!agent_host.get()) |
242 return; | 254 return; |
243 | 255 |
244 DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host.get()); | 256 DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host.get()); |
245 } | 257 } |
246 | 258 |
247 static void TerminateWorker(int process_id, int route_id) { | 259 static void TerminateWorker(int process_id, int route_id) { |
248 WorkerService::GetInstance()->TerminateWorker(process_id, route_id); | 260 WorkerService::GetInstance()->TerminateWorker(process_id, route_id); |
249 } | 261 } |
250 | 262 |
251 void InspectMessageHandler::HandleTerminateCommand(const ListValue* args) { | 263 void InspectMessageHandler::HandleTerminateCommand(const ListValue* args) { |
| 264 std::string page_id; |
| 265 if (GetRemotePageId(args, &page_id)) { |
| 266 inspect_ui_->CloseRemotePage(page_id); |
| 267 return; |
| 268 } |
| 269 |
252 int process_id; | 270 int process_id; |
253 int route_id; | 271 int route_id; |
254 if (!GetProcessAndRouteId(args, &process_id, &route_id)) | 272 if (!GetProcessAndRouteId(args, &process_id, &route_id)) |
255 return; | 273 return; |
256 | 274 |
257 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 275 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
258 base::Bind(&TerminateWorker, process_id, route_id)); | 276 base::Bind(&TerminateWorker, process_id, route_id)); |
259 } | 277 } |
260 | 278 |
| 279 void InspectMessageHandler::HandleReloadCommand(const ListValue* args) { |
| 280 std::string page_id; |
| 281 if (GetRemotePageId(args, &page_id)) |
| 282 inspect_ui_->ReloadRemotePage(page_id); |
| 283 } |
| 284 |
| 285 void InspectMessageHandler::HandleOpenCommand(const ListValue* args) { |
| 286 std::string browser_id; |
| 287 std::string url; |
| 288 if (args->GetSize() == 2 && |
| 289 args->GetString(0, &browser_id) && |
| 290 args->GetString(1, &url)) { |
| 291 inspect_ui_->OpenRemotePage(browser_id, url); |
| 292 } |
| 293 } |
| 294 |
261 bool InspectMessageHandler::GetProcessAndRouteId(const ListValue* args, | 295 bool InspectMessageHandler::GetProcessAndRouteId(const ListValue* args, |
262 int* process_id, | 296 int* process_id, |
263 int* route_id) { | 297 int* route_id) { |
264 const DictionaryValue* data; | 298 const DictionaryValue* data; |
265 if (args->GetSize() == 1 && args->GetDictionary(0, &data) && | 299 if (args->GetSize() == 1 && args->GetDictionary(0, &data) && |
266 data->GetInteger(kProcessIdField, process_id) && | 300 data->GetInteger(kProcessIdField, process_id) && |
267 data->GetInteger(kRouteIdField, route_id)) { | 301 data->GetInteger(kRouteIdField, route_id)) { |
268 return true; | 302 return true; |
269 } | 303 } |
270 return false; | 304 return false; |
(...skipping 16 matching lines...) Expand all Loading... |
287 const ListValue* args) { | 321 const ListValue* args) { |
288 Profile* profile = Profile::FromWebUI(web_ui()); | 322 Profile* profile = Profile::FromWebUI(web_ui()); |
289 if (!profile) | 323 if (!profile) |
290 return; | 324 return; |
291 | 325 |
292 const DictionaryValue* dict_src; | 326 const DictionaryValue* dict_src; |
293 if (args->GetSize() == 1 && args->GetDictionary(0, &dict_src)) | 327 if (args->GetSize() == 1 && args->GetDictionary(0, &dict_src)) |
294 profile->GetPrefs()->Set(prefs::kDevToolsPortForwardingConfig, *dict_src); | 328 profile->GetPrefs()->Set(prefs::kDevToolsPortForwardingConfig, *dict_src); |
295 } | 329 } |
296 | 330 |
| 331 bool InspectMessageHandler::GetRemotePageId(const ListValue* args, |
| 332 std::string* page_id) { |
| 333 const DictionaryValue* data; |
| 334 if (args->GetSize() == 1 && args->GetDictionary(0, &data) && |
| 335 data->GetString(kAdbGlobalIdField, page_id)) { |
| 336 return true; |
| 337 } |
| 338 return false; |
| 339 } |
| 340 |
297 } // namespace | 341 } // namespace |
298 | 342 |
299 class InspectUI::WorkerCreationDestructionListener | 343 class InspectUI::WorkerCreationDestructionListener |
300 : public WorkerServiceObserver, | 344 : public WorkerServiceObserver, |
301 public base::RefCountedThreadSafe<WorkerCreationDestructionListener> { | 345 public base::RefCountedThreadSafe<WorkerCreationDestructionListener> { |
302 public: | 346 public: |
303 WorkerCreationDestructionListener() | 347 WorkerCreationDestructionListener() |
304 : discovery_ui_(NULL) {} | 348 : discovery_ui_(NULL) {} |
305 | 349 |
306 void Init(InspectUI* workers_ui) { | 350 void Init(InspectUI* workers_ui) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 } | 451 } |
408 | 452 |
409 void InspectUI::InspectRemotePage(const std::string& id) { | 453 void InspectUI::InspectRemotePage(const std::string& id) { |
410 RemotePages::iterator it = remote_pages_.find(id); | 454 RemotePages::iterator it = remote_pages_.find(id); |
411 if (it != remote_pages_.end()) { | 455 if (it != remote_pages_.end()) { |
412 Profile* profile = Profile::FromWebUI(web_ui()); | 456 Profile* profile = Profile::FromWebUI(web_ui()); |
413 it->second->Inspect(profile); | 457 it->second->Inspect(profile); |
414 } | 458 } |
415 } | 459 } |
416 | 460 |
| 461 void InspectUI::ReloadRemotePage(const std::string& id) { |
| 462 RemotePages::iterator it = remote_pages_.find(id); |
| 463 if (it != remote_pages_.end()) |
| 464 it->second->Reload(); |
| 465 } |
| 466 |
| 467 void InspectUI::CloseRemotePage(const std::string& id) { |
| 468 RemotePages::iterator it = remote_pages_.find(id); |
| 469 if (it != remote_pages_.end()) |
| 470 it->second->Close(); |
| 471 } |
| 472 |
| 473 void InspectUI::OpenRemotePage(const std::string& browser_id, |
| 474 const std::string& url) { |
| 475 GURL gurl(url); |
| 476 if (!gurl.is_valid()) { |
| 477 gurl = GURL("http://" + url); |
| 478 if (!gurl.is_valid()) |
| 479 return; |
| 480 } |
| 481 RemoteBrowsers::iterator it = remote_browsers_.find(browser_id); |
| 482 if (it != remote_browsers_.end()) |
| 483 it->second->Open(gurl.spec()); |
| 484 } |
| 485 |
417 void InspectUI::PopulateLists() { | 486 void InspectUI::PopulateLists() { |
418 std::set<RenderViewHost*> tab_rvhs; | 487 std::set<RenderViewHost*> tab_rvhs; |
419 for (TabContentsIterator it; !it.done(); it.Next()) | 488 for (TabContentsIterator it; !it.done(); it.Next()) |
420 tab_rvhs.insert(it->GetRenderViewHost()); | 489 tab_rvhs.insert(it->GetRenderViewHost()); |
421 | 490 |
422 scoped_ptr<ListValue> target_list(new ListValue()); | 491 scoped_ptr<ListValue> target_list(new ListValue()); |
423 | 492 |
424 std::vector<RenderViewHost*> rvh_vector = | 493 std::vector<RenderViewHost*> rvh_vector = |
425 DevToolsAgentHost::GetValidRenderViewHosts(); | 494 DevToolsAgentHost::GetValidRenderViewHosts(); |
426 | 495 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 source->SetDefaultResource(IDR_INSPECT_HTML); | 565 source->SetDefaultResource(IDR_INSPECT_HTML); |
497 return source; | 566 return source; |
498 } | 567 } |
499 | 568 |
500 void InspectUI::RemoteDevicesChanged( | 569 void InspectUI::RemoteDevicesChanged( |
501 DevToolsAdbBridge::RemoteDevices* devices) { | 570 DevToolsAdbBridge::RemoteDevices* devices) { |
502 remote_pages_.clear(); | 571 remote_pages_.clear(); |
503 ListValue device_list; | 572 ListValue device_list; |
504 for (DevToolsAdbBridge::RemoteDevices::iterator dit = devices->begin(); | 573 for (DevToolsAdbBridge::RemoteDevices::iterator dit = devices->begin(); |
505 dit != devices->end(); ++dit) { | 574 dit != devices->end(); ++dit) { |
506 DevToolsAdbBridge::RemoteDevice& device = *(dit->get()); | 575 DevToolsAdbBridge::RemoteDevice* device = dit->get(); |
507 DictionaryValue* device_data = new DictionaryValue(); | 576 DictionaryValue* device_data = new DictionaryValue(); |
508 device_data->SetString(kAdbModelField, device.model()); | 577 device_data->SetString(kAdbModelField, device->model()); |
509 device_data->SetString(kAdbSerialField, device.serial()); | 578 device_data->SetString(kAdbSerialField, device->serial()); |
| 579 device_data->SetString(kAdbGlobalIdField, device->global_id()); |
510 ListValue* browser_list = new ListValue(); | 580 ListValue* browser_list = new ListValue(); |
511 device_data->Set(kAdbBrowsersField, browser_list); | 581 device_data->Set(kAdbBrowsersField, browser_list); |
512 | 582 |
513 DevToolsAdbBridge::RemoteBrowsers& browsers = device.browsers(); | 583 DevToolsAdbBridge::RemoteBrowsers& browsers = device->browsers(); |
514 for (DevToolsAdbBridge::RemoteBrowsers::iterator bit = | 584 for (DevToolsAdbBridge::RemoteBrowsers::iterator bit = |
515 browsers.begin(); bit != browsers.end(); ++bit) { | 585 browsers.begin(); bit != browsers.end(); ++bit) { |
516 DevToolsAdbBridge::RemoteBrowser& browser = *(bit->get()); | 586 DevToolsAdbBridge::RemoteBrowser* browser = bit->get(); |
517 DictionaryValue* browser_data = new DictionaryValue(); | 587 DictionaryValue* browser_data = new DictionaryValue(); |
518 browser_data->SetString(kAdbBrowserNameField, browser.name()); | 588 browser_data->SetString(kAdbBrowserNameField, browser->name()); |
| 589 browser_data->SetString(kAdbGlobalIdField, browser->global_id()); |
| 590 remote_browsers_[browser->global_id()] = browser; |
519 ListValue* page_list = new ListValue(); | 591 ListValue* page_list = new ListValue(); |
520 browser_data->Set(kAdbPagesField, page_list); | 592 browser_data->Set(kAdbPagesField, page_list); |
521 | 593 |
522 DevToolsAdbBridge::RemotePages& pages = browser.pages(); | 594 DevToolsAdbBridge::RemotePages& pages = browser->pages(); |
523 for (DevToolsAdbBridge::RemotePages::iterator it = | 595 for (DevToolsAdbBridge::RemotePages::iterator it = |
524 pages.begin(); it != pages.end(); ++it) { | 596 pages.begin(); it != pages.end(); ++it) { |
525 DevToolsAdbBridge::RemotePage* page = it->get(); | 597 DevToolsAdbBridge::RemotePage* page = it->get(); |
526 DictionaryValue* page_data = BuildTargetDescriptor(kAdbTargetType, | 598 DictionaryValue* page_data = BuildTargetDescriptor(kAdbTargetType, |
527 false, GURL(page->url()), page->title(), GURL(page->favicon_url()), | 599 false, GURL(page->url()), page->title(), GURL(page->favicon_url()), |
528 0, 0); | 600 0, 0); |
529 page_data->SetString(kAdbPageIdField, page->global_id()); | 601 page_data->SetString(kAdbGlobalIdField, page->global_id()); |
| 602 remote_pages_[page->global_id()] = page; |
530 page_list->Append(page_data); | 603 page_list->Append(page_data); |
531 remote_pages_[page->global_id()] = page; | |
532 } | 604 } |
533 browser_list->Append(browser_data); | 605 browser_list->Append(browser_data); |
534 } | 606 } |
535 device_list.Append(device_data); | 607 device_list.Append(device_data); |
536 } | 608 } |
537 web_ui()->CallJavascriptFunction("populateDeviceLists", device_list); | 609 web_ui()->CallJavascriptFunction("populateDeviceLists", device_list); |
538 } | 610 } |
539 | 611 |
540 void InspectUI::UpdatePortForwardingEnabled() { | 612 void InspectUI::UpdatePortForwardingEnabled() { |
541 Profile* profile = Profile::FromWebUI(web_ui()); | 613 Profile* profile = Profile::FromWebUI(web_ui()); |
542 const base::Value* value = profile->GetPrefs()->FindPreference( | 614 const base::Value* value = profile->GetPrefs()->FindPreference( |
543 prefs::kDevToolsPortForwardingEnabled)->GetValue(); | 615 prefs::kDevToolsPortForwardingEnabled)->GetValue(); |
544 web_ui()->CallJavascriptFunction("updatePortForwardingEnabled", *value); | 616 web_ui()->CallJavascriptFunction("updatePortForwardingEnabled", *value); |
545 | 617 |
546 } | 618 } |
547 | 619 |
548 void InspectUI::UpdatePortForwardingConfig() { | 620 void InspectUI::UpdatePortForwardingConfig() { |
549 Profile* profile = Profile::FromWebUI(web_ui()); | 621 Profile* profile = Profile::FromWebUI(web_ui()); |
550 const base::Value* value = profile->GetPrefs()->FindPreference( | 622 const base::Value* value = profile->GetPrefs()->FindPreference( |
551 prefs::kDevToolsPortForwardingConfig)->GetValue(); | 623 prefs::kDevToolsPortForwardingConfig)->GetValue(); |
552 web_ui()->CallJavascriptFunction("updatePortForwardingConfig", *value); | 624 web_ui()->CallJavascriptFunction("updatePortForwardingConfig", *value); |
553 } | 625 } |
OLD | NEW |