OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "apps/app_window_registry.h" | 5 #include "apps/app_window_registry.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/app_window.h" | 10 #include "apps/app_window.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 continue; | 273 continue; |
274 | 274 |
275 while (!registry->app_windows().empty()) | 275 while (!registry->app_windows().empty()) |
276 registry->app_windows().front()->GetBaseWindow()->Close(); | 276 registry->app_windows().front()->GetBaseWindow()->Close(); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 void AppWindowRegistry::OnDevToolsStateChanged( | 280 void AppWindowRegistry::OnDevToolsStateChanged( |
281 content::DevToolsAgentHost* agent_host, | 281 content::DevToolsAgentHost* agent_host, |
282 bool attached) { | 282 bool attached) { |
283 content::RenderViewHost* rvh = agent_host->GetRenderViewHost(); | 283 content::WebContents* web_contents = agent_host->GetWebContents(); |
284 // Ignore unrelated notifications. | 284 // Ignore unrelated notifications. |
285 if (!rvh || | 285 if (!web_contents || web_contents->GetBrowserContext() != context_) |
286 rvh->GetSiteInstance()->GetProcess()->GetBrowserContext() != context_) | |
287 return; | 286 return; |
288 | 287 |
289 std::string key = GetWindowKeyForRenderViewHost(this, rvh); | 288 std::string key = |
| 289 GetWindowKeyForRenderViewHost(this, web_contents->GetRenderViewHost()); |
290 if (key.empty()) | 290 if (key.empty()) |
291 return; | 291 return; |
292 | 292 |
293 if (attached) | 293 if (attached) |
294 inspected_windows_.insert(key); | 294 inspected_windows_.insert(key); |
295 else | 295 else |
296 inspected_windows_.erase(key); | 296 inspected_windows_.erase(key); |
297 } | 297 } |
298 | 298 |
299 void AppWindowRegistry::AddAppWindowToList(AppWindow* app_window) { | 299 void AppWindowRegistry::AddAppWindowToList(AppWindow* app_window) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 return false; | 347 return false; |
348 } | 348 } |
349 | 349 |
350 content::BrowserContext* AppWindowRegistry::Factory::GetBrowserContextToUse( | 350 content::BrowserContext* AppWindowRegistry::Factory::GetBrowserContextToUse( |
351 content::BrowserContext* context) const { | 351 content::BrowserContext* context) const { |
352 return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext( | 352 return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext( |
353 context); | 353 context); |
354 } | 354 } |
355 | 355 |
356 } // namespace apps | 356 } // namespace apps |
OLD | NEW |