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/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 if ((*it)->main_web_contents_ == web_contents || | 412 if ((*it)->main_web_contents_ == web_contents || |
413 (*it)->toolbox_web_contents_ == web_contents) | 413 (*it)->toolbox_web_contents_ == web_contents) |
414 return true; | 414 return true; |
415 } | 415 } |
416 return false; | 416 return false; |
417 } | 417 } |
418 | 418 |
419 // static | 419 // static |
420 DevToolsWindow* DevToolsWindow::OpenDevToolsWindowForWorker( | 420 DevToolsWindow* DevToolsWindow::OpenDevToolsWindowForWorker( |
421 Profile* profile, | 421 Profile* profile, |
422 DevToolsAgentHost* worker_agent) { | 422 const scoped_refptr<DevToolsAgentHost>& worker_agent) { |
423 DevToolsWindow* window = FindDevToolsWindow(worker_agent); | 423 DevToolsWindow* window = FindDevToolsWindow(worker_agent.get()); |
424 if (!window) { | 424 if (!window) { |
425 window = DevToolsWindow::CreateDevToolsWindowForWorker(profile); | 425 window = DevToolsWindow::CreateDevToolsWindowForWorker(profile); |
426 window->bindings_->AttachTo(worker_agent); | 426 window->bindings_->AttachTo(worker_agent); |
427 } | 427 } |
428 window->ScheduleShow(DevToolsToggleAction::Show()); | 428 window->ScheduleShow(DevToolsToggleAction::Show()); |
429 return window; | 429 return window; |
430 } | 430 } |
431 | 431 |
432 // static | 432 // static |
433 DevToolsWindow* DevToolsWindow::CreateDevToolsWindowForWorker( | 433 DevToolsWindow* DevToolsWindow::CreateDevToolsWindowForWorker( |
(...skipping 29 matching lines...) Expand all Loading... |
463 return ToggleDevToolsWindow( | 463 return ToggleDevToolsWindow( |
464 browser->tab_strip_model()->GetActiveWebContents(), | 464 browser->tab_strip_model()->GetActiveWebContents(), |
465 action.type() == DevToolsToggleAction::kInspect, | 465 action.type() == DevToolsToggleAction::kInspect, |
466 action, ""); | 466 action, ""); |
467 } | 467 } |
468 | 468 |
469 // static | 469 // static |
470 void DevToolsWindow::OpenExternalFrontend( | 470 void DevToolsWindow::OpenExternalFrontend( |
471 Profile* profile, | 471 Profile* profile, |
472 const std::string& frontend_url, | 472 const std::string& frontend_url, |
473 content::DevToolsAgentHost* agent_host, | 473 const scoped_refptr<content::DevToolsAgentHost>& agent_host, |
474 bool isWorker) { | 474 bool isWorker) { |
475 DevToolsWindow* window = FindDevToolsWindow(agent_host); | 475 DevToolsWindow* window = FindDevToolsWindow(agent_host.get()); |
476 if (!window) { | 476 if (!window) { |
477 window = Create(profile, DevToolsUI::GetProxyURL(frontend_url), NULL, | 477 window = Create(profile, DevToolsUI::GetProxyURL(frontend_url), NULL, |
478 isWorker, true, false, ""); | 478 isWorker, true, false, ""); |
479 window->bindings_->AttachTo(agent_host); | 479 window->bindings_->AttachTo(agent_host); |
480 } | 480 } |
481 window->ScheduleShow(DevToolsToggleAction::Show()); | 481 window->ScheduleShow(DevToolsToggleAction::Show()); |
482 } | 482 } |
483 | 483 |
484 // static | 484 // static |
485 DevToolsWindow* DevToolsWindow::ToggleDevToolsWindow( | 485 DevToolsWindow* DevToolsWindow::ToggleDevToolsWindow( |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 closure.Run(); | 1236 closure.Run(); |
1237 return; | 1237 return; |
1238 } | 1238 } |
1239 load_completed_callback_ = closure; | 1239 load_completed_callback_ = closure; |
1240 } | 1240 } |
1241 | 1241 |
1242 bool DevToolsWindow::ForwardKeyboardEvent( | 1242 bool DevToolsWindow::ForwardKeyboardEvent( |
1243 const content::NativeWebKeyboardEvent& event) { | 1243 const content::NativeWebKeyboardEvent& event) { |
1244 return event_forwarder_->ForwardEvent(event); | 1244 return event_forwarder_->ForwardEvent(event); |
1245 } | 1245 } |
OLD | NEW |