| 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 "extensions/browser/app_window/app_window_registry.h" | 5 #include "extensions/browser/app_window/app_window_registry.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 12 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
| 13 #include "content/public/browser/devtools_agent_host.h" | 13 #include "content/public/browser/devtools_agent_host.h" |
| 14 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 15 #include "content/public/browser/site_instance.h" | 15 #include "content/public/browser/site_instance.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "extensions/browser/app_window/app_window.h" | 17 #include "extensions/browser/app_window/app_window.h" |
| 18 #include "extensions/browser/app_window/native_app_window.h" | 18 #include "extensions/browser/app_window/native_app_window.h" |
| 19 #include "extensions/browser/extensions_browser_client.h" | 19 #include "extensions/browser/extensions_browser_client.h" |
| 20 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 | 23 |
| 24 void AppWindowRegistry::Observer::OnAppWindowAdded(AppWindow* app_window) { | 24 void AppWindowRegistry::Observer::OnAppWindowAdded(AppWindow* app_window) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 void AppWindowRegistry::Observer::OnAppWindowIconChanged( | |
| 28 AppWindow* app_window) { | |
| 29 } | |
| 30 | |
| 31 void AppWindowRegistry::Observer::OnAppWindowRemoved(AppWindow* app_window) { | 27 void AppWindowRegistry::Observer::OnAppWindowRemoved(AppWindow* app_window) { |
| 32 } | 28 } |
| 33 | 29 |
| 34 void AppWindowRegistry::Observer::OnAppWindowHidden(AppWindow* app_window) { | 30 void AppWindowRegistry::Observer::OnAppWindowHidden(AppWindow* app_window) { |
| 35 } | 31 } |
| 36 | 32 |
| 37 void AppWindowRegistry::Observer::OnAppWindowShown(AppWindow* app_window, | 33 void AppWindowRegistry::Observer::OnAppWindowShown(AppWindow* app_window, |
| 38 bool was_shown) { | 34 bool was_shown) { |
| 39 } | 35 } |
| 40 | 36 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 57 AppWindowRegistry* AppWindowRegistry::Get(content::BrowserContext* context) { | 53 AppWindowRegistry* AppWindowRegistry::Get(content::BrowserContext* context) { |
| 58 return Factory::GetForBrowserContext(context, true /* create */); | 54 return Factory::GetForBrowserContext(context, true /* create */); |
| 59 } | 55 } |
| 60 | 56 |
| 61 void AppWindowRegistry::AddAppWindow(AppWindow* app_window) { | 57 void AppWindowRegistry::AddAppWindow(AppWindow* app_window) { |
| 62 BringToFront(app_window); | 58 BringToFront(app_window); |
| 63 for (auto& observer : observers_) | 59 for (auto& observer : observers_) |
| 64 observer.OnAppWindowAdded(app_window); | 60 observer.OnAppWindowAdded(app_window); |
| 65 } | 61 } |
| 66 | 62 |
| 67 void AppWindowRegistry::AppWindowIconChanged(AppWindow* app_window) { | |
| 68 AddAppWindowToList(app_window); | |
| 69 for (auto& observer : observers_) | |
| 70 observer.OnAppWindowIconChanged(app_window); | |
| 71 } | |
| 72 | |
| 73 void AppWindowRegistry::AppWindowActivated(AppWindow* app_window) { | 63 void AppWindowRegistry::AppWindowActivated(AppWindow* app_window) { |
| 74 BringToFront(app_window); | 64 BringToFront(app_window); |
| 75 for (auto& observer : observers_) | 65 for (auto& observer : observers_) |
| 76 observer.OnAppWindowActivated(app_window); | 66 observer.OnAppWindowActivated(app_window); |
| 77 } | 67 } |
| 78 | 68 |
| 79 void AppWindowRegistry::AppWindowHidden(AppWindow* app_window) { | 69 void AppWindowRegistry::AppWindowHidden(AppWindow* app_window) { |
| 80 for (auto& observer : observers_) | 70 for (auto& observer : observers_) |
| 81 observer.OnAppWindowHidden(app_window); | 71 observer.OnAppWindowHidden(app_window); |
| 82 } | 72 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 bool AppWindowRegistry::Factory::ServiceIsNULLWhileTesting() const { | 258 bool AppWindowRegistry::Factory::ServiceIsNULLWhileTesting() const { |
| 269 return false; | 259 return false; |
| 270 } | 260 } |
| 271 | 261 |
| 272 content::BrowserContext* AppWindowRegistry::Factory::GetBrowserContextToUse( | 262 content::BrowserContext* AppWindowRegistry::Factory::GetBrowserContextToUse( |
| 273 content::BrowserContext* context) const { | 263 content::BrowserContext* context) const { |
| 274 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 264 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
| 275 } | 265 } |
| 276 | 266 |
| 277 } // namespace extensions | 267 } // namespace extensions |
| OLD | NEW |