| OLD | NEW |
| 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 "chrome/browser/browser_process.h" | 5 #include "chrome/browser/browser_process.h" |
| 6 #include "chrome/browser/extensions/shell_window_registry.h" | 6 #include "chrome/browser/extensions/shell_window_registry.h" |
| 7 #include "chrome/browser/profiles/profile_dependency_manager.h" | 7 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/ui/extensions/native_app_window.h" | 9 #include "chrome/browser/ui/extensions/native_app_window.h" |
| 10 #include "chrome/browser/ui/extensions/shell_window.h" | 10 #include "chrome/browser/ui/extensions/shell_window.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 FOR_EACH_OBSERVER(Observer, observers_, OnShellWindowAdded(shell_window)); | 60 FOR_EACH_OBSERVER(Observer, observers_, OnShellWindowAdded(shell_window)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void ShellWindowRegistry::ShellWindowIconChanged(ShellWindow* shell_window) { | 63 void ShellWindowRegistry::ShellWindowIconChanged(ShellWindow* shell_window) { |
| 64 shell_windows_.insert(shell_window); | 64 shell_windows_.insert(shell_window); |
| 65 FOR_EACH_OBSERVER(Observer, observers_, | 65 FOR_EACH_OBSERVER(Observer, observers_, |
| 66 OnShellWindowIconChanged(shell_window)); | 66 OnShellWindowIconChanged(shell_window)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void ShellWindowRegistry::RemoveShellWindow(ShellWindow* shell_window) { | 69 void ShellWindowRegistry::RemoveShellWindow(ShellWindow* shell_window) { |
| 70 shell_windows_.erase(shell_window); | 70 size_t num_erased = shell_windows_.erase(shell_window); |
| 71 FOR_EACH_OBSERVER(Observer, observers_, OnShellWindowRemoved(shell_window)); | 71 if (num_erased > 0) |
| 72 FOR_EACH_OBSERVER(Observer, observers_, OnShellWindowRemoved(shell_window)); |
| 72 } | 73 } |
| 73 | 74 |
| 74 void ShellWindowRegistry::AddObserver(Observer* observer) { | 75 void ShellWindowRegistry::AddObserver(Observer* observer) { |
| 75 observers_.AddObserver(observer); | 76 observers_.AddObserver(observer); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void ShellWindowRegistry::RemoveObserver(Observer* observer) { | 79 void ShellWindowRegistry::RemoveObserver(Observer* observer) { |
| 79 observers_.RemoveObserver(observer); | 80 observers_.RemoveObserver(observer); |
| 80 } | 81 } |
| 81 | 82 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 bool ShellWindowRegistry::Factory::ServiceIsCreatedWithProfile() const { | 218 bool ShellWindowRegistry::Factory::ServiceIsCreatedWithProfile() const { |
| 218 return true; | 219 return true; |
| 219 } | 220 } |
| 220 | 221 |
| 221 bool ShellWindowRegistry::Factory::ServiceIsNULLWhileTesting() const { | 222 bool ShellWindowRegistry::Factory::ServiceIsNULLWhileTesting() const { |
| 222 return false; | 223 return false; |
| 223 } | 224 } |
| 224 | 225 |
| 225 } // namespace extensions | 226 } // namespace extensions |
| OLD | NEW |