Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: content/browser/devtools/devtools_manager_impl.cc

Issue 251653003: Introduces DevToolsManagerDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Register OpenDevToolsWindowForWorkerCallback to DevToolsManager Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/devtools/devtools_manager_impl.h" 5 #include "content/browser/devtools/devtools_manager_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 callbacks_.push_back(&callback); 174 callbacks_.push_back(&callback);
175 } 175 }
176 176
177 void DevToolsManagerImpl::RemoveAgentStateCallback(const Callback& callback) { 177 void DevToolsManagerImpl::RemoveAgentStateCallback(const Callback& callback) {
178 CallbackContainer::iterator it = 178 CallbackContainer::iterator it =
179 std::find(callbacks_.begin(), callbacks_.end(), &callback); 179 std::find(callbacks_.begin(), callbacks_.end(), &callback);
180 DCHECK(it != callbacks_.end()); 180 DCHECK(it != callbacks_.end());
181 callbacks_.erase(it); 181 callbacks_.erase(it);
182 } 182 }
183 183
184 void DevToolsManagerImpl::RegisterOpenDevToolsWindowForWorkerCallback(
185 const WindowOpenCallback& window_open_callback) {
186 open_window_for_worker_callback_ = window_open_callback;
187 }
188
189 void DevToolsManagerImpl::OpenDevToolsWindowForWorker(
190 BrowserContext* browser_context,
191 DevToolsAgentHost* agent_host) {
192 if (open_window_for_worker_callback_.is_null())
193 return;
194 open_window_for_worker_callback_.Run(browser_context, agent_host);
195 }
196
184 void DevToolsManagerImpl::NotifyObservers(DevToolsAgentHost* agent_host, 197 void DevToolsManagerImpl::NotifyObservers(DevToolsAgentHost* agent_host,
185 bool attached) { 198 bool attached) {
186 CallbackContainer copy(callbacks_); 199 CallbackContainer copy(callbacks_);
187 for (CallbackContainer::iterator it = copy.begin(); it != copy.end(); ++it) 200 for (CallbackContainer::iterator it = copy.begin(); it != copy.end(); ++it)
188 (*it)->Run(agent_host, attached); 201 (*it)->Run(agent_host, attached);
189 } 202 }
190 203
191 } // namespace content 204 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698