| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 } // namespace | 262 } // namespace |
| 263 | 263 |
| 264 const char DevToolsWindow::kDevToolsApp[] = "DevToolsApp"; | 264 const char DevToolsWindow::kDevToolsApp[] = "DevToolsApp"; |
| 265 | 265 |
| 266 DevToolsWindow::~DevToolsWindow() { | 266 DevToolsWindow::~DevToolsWindow() { |
| 267 content::DevToolsManager::GetInstance()->ClientHostClosing( | 267 content::DevToolsManager::GetInstance()->ClientHostClosing( |
| 268 frontend_host_.get()); | 268 frontend_host_.get()); |
| 269 UpdateBrowserToolbar(); | 269 UpdateBrowserToolbar(); |
| 270 | 270 |
| 271 DevToolsWindows* instances = &g_instances.Get(); | 271 DevToolsWindows* instances = g_instances.Pointer(); |
| 272 DevToolsWindows::iterator it( | 272 DevToolsWindows::iterator it( |
| 273 std::find(instances->begin(), instances->end(), this)); | 273 std::find(instances->begin(), instances->end(), this)); |
| 274 DCHECK(it != instances->end()); | 274 DCHECK(it != instances->end()); |
| 275 instances->erase(it); | 275 instances->erase(it); |
| 276 | 276 |
| 277 for (IndexingJobsMap::const_iterator jobs_it(indexing_jobs_.begin()); | 277 for (IndexingJobsMap::const_iterator jobs_it(indexing_jobs_.begin()); |
| 278 jobs_it != indexing_jobs_.end(); ++jobs_it) { | 278 jobs_it != indexing_jobs_.end(); ++jobs_it) { |
| 279 jobs_it->second->Stop(); | 279 jobs_it->second->Stop(); |
| 280 } | 280 } |
| 281 indexing_jobs_.clear(); | 281 indexing_jobs_.clear(); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 if (CommandLine::ForCurrentProcess()->HasSwitch( | 713 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 714 switches::kEnableDevToolsExperiments)) | 714 switches::kEnableDevToolsExperiments)) |
| 715 url_string += "&experiments=true"; | 715 url_string += "&experiments=true"; |
| 716 url_string += "&updateAppcache"; | 716 url_string += "&updateAppcache"; |
| 717 return GURL(url_string); | 717 return GURL(url_string); |
| 718 } | 718 } |
| 719 | 719 |
| 720 // static | 720 // static |
| 721 DevToolsWindow* DevToolsWindow::FindDevToolsWindow( | 721 DevToolsWindow* DevToolsWindow::FindDevToolsWindow( |
| 722 DevToolsAgentHost* agent_host) { | 722 DevToolsAgentHost* agent_host) { |
| 723 DevToolsWindows* instances = &g_instances.Get(); | 723 DevToolsWindows* instances = g_instances.Pointer(); |
| 724 content::DevToolsManager* manager = content::DevToolsManager::GetInstance(); | 724 content::DevToolsManager* manager = content::DevToolsManager::GetInstance(); |
| 725 for (DevToolsWindows::iterator it(instances->begin()); it != instances->end(); | 725 for (DevToolsWindows::iterator it(instances->begin()); it != instances->end(); |
| 726 ++it) { | 726 ++it) { |
| 727 if (manager->GetDevToolsAgentHostFor((*it)->frontend_host_.get()) == | 727 if (manager->GetDevToolsAgentHostFor((*it)->frontend_host_.get()) == |
| 728 agent_host) | 728 agent_host) |
| 729 return *it; | 729 return *it; |
| 730 } | 730 } |
| 731 return NULL; | 731 return NULL; |
| 732 } | 732 } |
| 733 | 733 |
| 734 // static | 734 // static |
| 735 DevToolsWindow* DevToolsWindow::AsDevToolsWindow( | 735 DevToolsWindow* DevToolsWindow::AsDevToolsWindow( |
| 736 content::RenderViewHost* window_rvh) { | 736 content::RenderViewHost* window_rvh) { |
| 737 if (g_instances == NULL) | 737 if (g_instances == NULL) |
| 738 return NULL; | 738 return NULL; |
| 739 DevToolsWindows* instances = &g_instances.Get(); | 739 DevToolsWindows* instances = g_instances.Pointer(); |
| 740 for (DevToolsWindows::iterator it(instances->begin()); it != instances->end(); | 740 for (DevToolsWindows::iterator it(instances->begin()); it != instances->end(); |
| 741 ++it) { | 741 ++it) { |
| 742 if ((*it)->web_contents_->GetRenderViewHost() == window_rvh) | 742 if ((*it)->web_contents_->GetRenderViewHost() == window_rvh) |
| 743 return *it; | 743 return *it; |
| 744 } | 744 } |
| 745 return NULL; | 745 return NULL; |
| 746 } | 746 } |
| 747 | 747 |
| 748 // static | 748 // static |
| 749 DevToolsDockSide DevToolsWindow::GetDockSideFromPrefs(Profile* profile) { | 749 DevToolsDockSide DevToolsWindow::GetDockSideFromPrefs(Profile* profile) { |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 return inspected_contents_observer_ ? | 1495 return inspected_contents_observer_ ? |
| 1496 inspected_contents_observer_->web_contents() : NULL; | 1496 inspected_contents_observer_->web_contents() : NULL; |
| 1497 } | 1497 } |
| 1498 | 1498 |
| 1499 void DevToolsWindow::DocumentOnLoadCompletedInMainFrame() { | 1499 void DevToolsWindow::DocumentOnLoadCompletedInMainFrame() { |
| 1500 is_loaded_ = true; | 1500 is_loaded_ = true; |
| 1501 UpdateTheme(); | 1501 UpdateTheme(); |
| 1502 DoAction(); | 1502 DoAction(); |
| 1503 AddDevToolsExtensionsToClient(); | 1503 AddDevToolsExtensionsToClient(); |
| 1504 } | 1504 } |
| OLD | NEW |