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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "apps/app_lifetime_monitor_factory.h" | 8 #include "apps/app_lifetime_monitor_factory.h" |
9 #include "apps/switches.h" | 9 #include "apps/switches.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 }; | 156 }; |
157 | 157 |
158 // Watches for a hosted app browser window to open. | 158 // Watches for a hosted app browser window to open. |
159 class HostedAppBrowserListObserver : public chrome::BrowserListObserver { | 159 class HostedAppBrowserListObserver : public chrome::BrowserListObserver { |
160 public: | 160 public: |
161 explicit HostedAppBrowserListObserver(const std::string& app_id) | 161 explicit HostedAppBrowserListObserver(const std::string& app_id) |
162 : app_id_(app_id), observed_add_(false), observed_removed_(false) { | 162 : app_id_(app_id), observed_add_(false), observed_removed_(false) { |
163 BrowserList::AddObserver(this); | 163 BrowserList::AddObserver(this); |
164 } | 164 } |
165 | 165 |
166 ~HostedAppBrowserListObserver() { BrowserList::RemoveObserver(this); } | 166 ~HostedAppBrowserListObserver() override { |
| 167 BrowserList::RemoveObserver(this); |
| 168 } |
167 | 169 |
168 void WaitUntilAdded() { | 170 void WaitUntilAdded() { |
169 if (observed_add_) | 171 if (observed_add_) |
170 return; | 172 return; |
171 | 173 |
172 run_loop_.reset(new base::RunLoop); | 174 run_loop_.reset(new base::RunLoop); |
173 run_loop_->Run(); | 175 run_loop_->Run(); |
174 } | 176 } |
175 | 177 |
176 void WaitUntilRemoved() { | 178 void WaitUntilRemoved() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 212 |
211 DISALLOW_COPY_AND_ASSIGN(HostedAppBrowserListObserver); | 213 DISALLOW_COPY_AND_ASSIGN(HostedAppBrowserListObserver); |
212 }; | 214 }; |
213 | 215 |
214 class AppLifetimeMonitorObserver : public apps::AppLifetimeMonitor::Observer { | 216 class AppLifetimeMonitorObserver : public apps::AppLifetimeMonitor::Observer { |
215 public: | 217 public: |
216 AppLifetimeMonitorObserver(Profile* profile) | 218 AppLifetimeMonitorObserver(Profile* profile) |
217 : profile_(profile), activated_count_(0), deactivated_count_(0) { | 219 : profile_(profile), activated_count_(0), deactivated_count_(0) { |
218 apps::AppLifetimeMonitorFactory::GetForProfile(profile_)->AddObserver(this); | 220 apps::AppLifetimeMonitorFactory::GetForProfile(profile_)->AddObserver(this); |
219 } | 221 } |
220 virtual ~AppLifetimeMonitorObserver() { | 222 ~AppLifetimeMonitorObserver() override { |
221 apps::AppLifetimeMonitorFactory::GetForProfile(profile_) | 223 apps::AppLifetimeMonitorFactory::GetForProfile(profile_) |
222 ->RemoveObserver(this); | 224 ->RemoveObserver(this); |
223 } | 225 } |
224 | 226 |
225 int activated_count() { return activated_count_; } | 227 int activated_count() { return activated_count_; } |
226 int deactivated_count() { return deactivated_count_; } | 228 int deactivated_count() { return deactivated_count_; } |
227 | 229 |
228 protected: | 230 protected: |
229 // AppLifetimeMonitor::Observer overrides: | 231 // AppLifetimeMonitor::Observer overrides: |
230 void OnAppActivated(Profile* profile, const std::string& app_id) override { | 232 void OnAppActivated(Profile* profile, const std::string& app_id) override { |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 // the shim is rebuilt. | 708 // the shim is rebuilt. |
707 WindowedAppShimLaunchObserver(app->id()).Wait(); | 709 WindowedAppShimLaunchObserver(app->id()).Wait(); |
708 | 710 |
709 EXPECT_TRUE(GetFirstAppWindow()); | 711 EXPECT_TRUE(GetFirstAppWindow()); |
710 EXPECT_TRUE(HasAppShimHost(profile(), app->id())); | 712 EXPECT_TRUE(HasAppShimHost(profile(), app->id())); |
711 } | 713 } |
712 | 714 |
713 #endif // defined(ARCH_CPU_64_BITS) | 715 #endif // defined(ARCH_CPU_64_BITS) |
714 | 716 |
715 } // namespace apps | 717 } // namespace apps |
OLD | NEW |