| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_lifetime_monitor.h" | 5 #include "apps/app_lifetime_monitor.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "content/public/browser/notification_details.h" | 9 #include "content/public/browser/notification_details.h" |
| 10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 for (AppWindowRegistry::AppWindowList::const_iterator i = windows.begin(); | 118 for (AppWindowRegistry::AppWindowList::const_iterator i = windows.begin(); |
| 119 i != windows.end(); | 119 i != windows.end(); |
| 120 ++i) { | 120 ++i) { |
| 121 if (*i != app_window && !(*i)->is_hidden()) | 121 if (*i != app_window && !(*i)->is_hidden()) |
| 122 return true; | 122 return true; |
| 123 } | 123 } |
| 124 return false; | 124 return false; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void AppLifetimeMonitor::NotifyAppStart(const std::string& app_id) { | 127 void AppLifetimeMonitor::NotifyAppStart(const std::string& app_id) { |
| 128 FOR_EACH_OBSERVER(Observer, observers_, OnAppStart(profile_, app_id)); | 128 for (auto& observer : observers_) |
| 129 observer.OnAppStart(profile_, app_id); |
| 129 } | 130 } |
| 130 | 131 |
| 131 void AppLifetimeMonitor::NotifyAppActivated(const std::string& app_id) { | 132 void AppLifetimeMonitor::NotifyAppActivated(const std::string& app_id) { |
| 132 FOR_EACH_OBSERVER(Observer, observers_, OnAppActivated(profile_, app_id)); | 133 for (auto& observer : observers_) |
| 134 observer.OnAppActivated(profile_, app_id); |
| 133 } | 135 } |
| 134 | 136 |
| 135 void AppLifetimeMonitor::NotifyAppDeactivated(const std::string& app_id) { | 137 void AppLifetimeMonitor::NotifyAppDeactivated(const std::string& app_id) { |
| 136 FOR_EACH_OBSERVER(Observer, observers_, OnAppDeactivated(profile_, app_id)); | 138 for (auto& observer : observers_) |
| 139 observer.OnAppDeactivated(profile_, app_id); |
| 137 } | 140 } |
| 138 | 141 |
| 139 void AppLifetimeMonitor::NotifyAppStop(const std::string& app_id) { | 142 void AppLifetimeMonitor::NotifyAppStop(const std::string& app_id) { |
| 140 FOR_EACH_OBSERVER(Observer, observers_, OnAppStop(profile_, app_id)); | 143 for (auto& observer : observers_) |
| 144 observer.OnAppStop(profile_, app_id); |
| 141 } | 145 } |
| 142 | 146 |
| 143 void AppLifetimeMonitor::NotifyChromeTerminating() { | 147 void AppLifetimeMonitor::NotifyChromeTerminating() { |
| 144 FOR_EACH_OBSERVER(Observer, observers_, OnChromeTerminating()); | 148 for (auto& observer : observers_) |
| 149 observer.OnChromeTerminating(); |
| 145 } | 150 } |
| 146 | 151 |
| 147 } // namespace apps | 152 } // namespace apps |
| OLD | NEW |