| 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" |
| 11 #include "apps/ui/apps_client.h" | 11 #include "apps/ui/apps_client.h" |
| 12 #include "apps/ui/native_app_window.h" | 12 #include "apps/ui/native_app_window.h" |
| 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 14 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
| 15 #include "content/public/browser/devtools_agent_host.h" | 15 #include "content/public/browser/devtools_agent_host.h" |
| 16 #include "content/public/browser/devtools_manager.h" | |
| 17 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
| 18 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
| 19 #include "content/public/browser/site_instance.h" | 18 #include "content/public/browser/site_instance.h" |
| 20 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 21 #include "extensions/browser/extensions_browser_client.h" | 20 #include "extensions/browser/extensions_browser_client.h" |
| 22 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
| 23 | 22 |
| 24 namespace { | 23 namespace { |
| 25 | 24 |
| 26 // Create a key that identifies a AppWindow in a RenderViewHost across App | 25 // Create a key that identifies a AppWindow in a RenderViewHost across App |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 void AppWindowRegistry::Observer::OnAppWindowShown(AppWindow* app_window) { | 64 void AppWindowRegistry::Observer::OnAppWindowShown(AppWindow* app_window) { |
| 66 } | 65 } |
| 67 | 66 |
| 68 AppWindowRegistry::Observer::~Observer() { | 67 AppWindowRegistry::Observer::~Observer() { |
| 69 } | 68 } |
| 70 | 69 |
| 71 AppWindowRegistry::AppWindowRegistry(content::BrowserContext* context) | 70 AppWindowRegistry::AppWindowRegistry(content::BrowserContext* context) |
| 72 : context_(context), | 71 : context_(context), |
| 73 devtools_callback_(base::Bind(&AppWindowRegistry::OnDevToolsStateChanged, | 72 devtools_callback_(base::Bind(&AppWindowRegistry::OnDevToolsStateChanged, |
| 74 base::Unretained(this))) { | 73 base::Unretained(this))) { |
| 75 content::DevToolsManager::GetInstance()->AddAgentStateCallback( | 74 content::DevToolsAgentHost::AddAgentStateCallback(devtools_callback_); |
| 76 devtools_callback_); | |
| 77 } | 75 } |
| 78 | 76 |
| 79 AppWindowRegistry::~AppWindowRegistry() { | 77 AppWindowRegistry::~AppWindowRegistry() { |
| 80 content::DevToolsManager::GetInstance()->RemoveAgentStateCallback( | 78 content::DevToolsAgentHost::RemoveAgentStateCallback(devtools_callback_); |
| 81 devtools_callback_); | |
| 82 } | 79 } |
| 83 | 80 |
| 84 // static | 81 // static |
| 85 AppWindowRegistry* AppWindowRegistry::Get(content::BrowserContext* context) { | 82 AppWindowRegistry* AppWindowRegistry::Get(content::BrowserContext* context) { |
| 86 return Factory::GetForBrowserContext(context, true /* create */); | 83 return Factory::GetForBrowserContext(context, true /* create */); |
| 87 } | 84 } |
| 88 | 85 |
| 89 void AppWindowRegistry::AddAppWindow(AppWindow* app_window) { | 86 void AppWindowRegistry::AddAppWindow(AppWindow* app_window) { |
| 90 BringToFront(app_window); | 87 BringToFront(app_window); |
| 91 FOR_EACH_OBSERVER(Observer, observers_, OnAppWindowAdded(app_window)); | 88 FOR_EACH_OBSERVER(Observer, observers_, OnAppWindowAdded(app_window)); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 return false; | 344 return false; |
| 348 } | 345 } |
| 349 | 346 |
| 350 content::BrowserContext* AppWindowRegistry::Factory::GetBrowserContextToUse( | 347 content::BrowserContext* AppWindowRegistry::Factory::GetBrowserContextToUse( |
| 351 content::BrowserContext* context) const { | 348 content::BrowserContext* context) const { |
| 352 return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext( | 349 return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext( |
| 353 context); | 350 context); |
| 354 } | 351 } |
| 355 | 352 |
| 356 } // namespace apps | 353 } // namespace apps |
| OLD | NEW |