Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 RenderViewHost* window_rvh) { | 67 RenderViewHost* window_rvh) { |
| 68 for (DevToolsWindowList::iterator it = instances_.begin(); | 68 for (DevToolsWindowList::iterator it = instances_.begin(); |
| 69 it != instances_.end(); ++it) { | 69 it != instances_.end(); ++it) { |
| 70 if ((*it)->GetRenderViewHost() == window_rvh) | 70 if ((*it)->GetRenderViewHost() == window_rvh) |
| 71 return *it; | 71 return *it; |
| 72 } | 72 } |
| 73 return NULL; | 73 return NULL; |
| 74 } | 74 } |
| 75 | 75 |
| 76 // static | 76 // static |
| 77 DevToolsWindow* DevToolsWindow::CreateDevToolsWindowForWorker( | |
| 78 Profile* profile) { | |
| 79 return new DevToolsWindow(profile, NULL, false); | |
| 80 } | |
| 81 | |
| 82 // static | |
| 77 DevToolsWindow* DevToolsWindow::OpenDevToolsWindow( | 83 DevToolsWindow* DevToolsWindow::OpenDevToolsWindow( |
| 78 RenderViewHost* inspected_rvh) { | 84 RenderViewHost* inspected_rvh) { |
| 79 return ToggleDevToolsWindow(inspected_rvh, true, | 85 return ToggleDevToolsWindow(inspected_rvh, true, |
| 80 DEVTOOLS_TOGGLE_ACTION_NONE); | 86 DEVTOOLS_TOGGLE_ACTION_NONE); |
| 81 } | 87 } |
| 82 | 88 |
| 83 // static | 89 // static |
| 84 DevToolsWindow* DevToolsWindow::ToggleDevToolsWindow( | 90 DevToolsWindow* DevToolsWindow::ToggleDevToolsWindow( |
| 85 RenderViewHost* inspected_rvh, | 91 RenderViewHost* inspected_rvh, |
| 86 DevToolsToggleAction action) { | 92 DevToolsToggleAction action) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 registrar_.Add(this, | 129 registrar_.Add(this, |
| 124 NotificationType::LOAD_STOP, | 130 NotificationType::LOAD_STOP, |
| 125 Source<NavigationController>(&tab_contents_->controller())); | 131 Source<NavigationController>(&tab_contents_->controller())); |
| 126 registrar_.Add(this, | 132 registrar_.Add(this, |
| 127 NotificationType::TAB_CLOSING, | 133 NotificationType::TAB_CLOSING, |
| 128 Source<NavigationController>(&tab_contents_->controller())); | 134 Source<NavigationController>(&tab_contents_->controller())); |
| 129 registrar_.Add( | 135 registrar_.Add( |
| 130 this, | 136 this, |
| 131 NotificationType::BROWSER_THEME_CHANGED, | 137 NotificationType::BROWSER_THEME_CHANGED, |
| 132 Source<ThemeService>(ThemeServiceFactory::GetForProfile(profile_))); | 138 Source<ThemeService>(ThemeServiceFactory::GetForProfile(profile_))); |
| 133 TabContents* tab = inspected_rvh->delegate()->GetAsTabContents(); | 139 // There is now inspected_rvh in case of shared workers. |
|
pfeldman
2011/07/11 12:07:16
There is _no_ inspected_rvh ?
yurys
2011/07/11 15:13:11
Done.
| |
| 134 if (tab) | 140 if (inspected_rvh) { |
| 135 inspected_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); | 141 TabContents* tab = inspected_rvh->delegate()->GetAsTabContents(); |
| 136 | 142 if (tab) |
| 143 inspected_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); | |
| 144 } | |
| 137 instances_.push_back(this); | 145 instances_.push_back(this); |
| 138 } | 146 } |
| 139 | 147 |
| 140 DevToolsWindow::~DevToolsWindow() { | 148 DevToolsWindow::~DevToolsWindow() { |
| 141 DevToolsWindowList::iterator it = std::find(instances_.begin(), | 149 DevToolsWindowList::iterator it = std::find(instances_.begin(), |
| 142 instances_.end(), | 150 instances_.end(), |
| 143 this); | 151 this); |
| 144 DCHECK(it != instances_.end()); | 152 DCHECK(it != instances_.end()); |
| 145 instances_.erase(it); | 153 instances_.erase(it); |
| 146 } | 154 } |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 DevToolsClientHost* client_host) { | 569 DevToolsClientHost* client_host) { |
| 562 if (!client_host) | 570 if (!client_host) |
| 563 return NULL; | 571 return NULL; |
| 564 DevToolsWindowList::iterator it = std::find(instances_.begin(), | 572 DevToolsWindowList::iterator it = std::find(instances_.begin(), |
| 565 instances_.end(), | 573 instances_.end(), |
| 566 client_host); | 574 client_host); |
| 567 if (it == instances_.end()) | 575 if (it == instances_.end()) |
| 568 return NULL; | 576 return NULL; |
| 569 return *it; | 577 return *it; |
| 570 } | 578 } |
| OLD | NEW |